Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/core/Downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,21 @@ export class Downloader {

public filepath: string;

public fileName: string;

public bulk: boolean;

public headers: Headers;

public cookieJar: CookieJar;

constructor({ progress, proxy, noWaterMark, headers, filepath, bulk, cookieJar }: DownloaderConstructor) {
constructor({ progress, proxy, noWaterMark, headers, filepath, fileName, bulk, cookieJar }: DownloaderConstructor) {
this.progress = true || progress;
this.progressBar = [];
this.noWaterMark = noWaterMark;
this.headers = headers;
this.filepath = filepath;
this.fileName = fileName
this.mbars = new MultipleBar();
this.proxy = proxy;
this.bulk = bulk;
Expand Down Expand Up @@ -209,6 +212,6 @@ export class Downloader {

const result = await rp(options);

await fromCallback(cb => writeFile(`${this.filepath}/${post.id}.mp4`, result, cb));
await fromCallback(cb => writeFile(`${this.filepath}/${this.fileName || post.id}.mp4`, result, cb));
}
}
1 change: 1 addition & 0 deletions src/core/TikTok.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export class TikTokScraper extends EventEmitter {
noWaterMark,
headers,
filepath: process.env.SCRAPING_FROM_DOCKER ? '/usr/app/files' : filepath || '',
fileName: fileName,
bulk,
});
this.webHookUrl = webHookUrl;
Expand Down
2 changes: 1 addition & 1 deletion src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export const video = async (input: string, options = {} as Options): Promise<any
}

return {
...(options?.download ? { message: `Video location: ${contructor.filepath}/${result.id}.mp4` } : {}),
...(options?.download ? { message: `Video location: ${path}.mp4` } : {}),
...outputMessage,
};
};
Expand Down
1 change: 1 addition & 0 deletions src/types/Downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface DownloaderConstructor {
noWaterMark: boolean;
headers: Headers;
filepath: string;
fileName: string;
bulk: boolean;
cookieJar: CookieJar;
}
Expand Down