Main script file completes the job.
This commit is contained in:
parent
7549e5b3f8
commit
20e304aa97
@ -88,17 +88,19 @@ class JDownloaderClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async startDownload(crawledLinks = []) {
|
async startDownload(crawledLinks = []) {
|
||||||
if (!crawledLinks.packageUUID) {
|
|
||||||
throw new JDownloaderError('Cannot start download without packageUUID!');
|
|
||||||
}
|
|
||||||
|
|
||||||
const linkIDs = crawledLinks.map((link) => link.uuid);
|
const linkIDs = crawledLinks.map((link) => link.uuid);
|
||||||
|
|
||||||
if (linkIDs.length < 1) {
|
if (linkIDs.length < 1) {
|
||||||
throw new JDownloaderError('No links to download!');
|
throw new JDownloaderError('No links to download!');
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.client.core.callAction('/linkgrabberv2/moveToDownloadlist', this.device.id, [linkIDs, [crawledLinks.packageUUID]]);
|
const packageUUID = crawledLinks[0].packageUUID;
|
||||||
|
|
||||||
|
if (!packageUUID) {
|
||||||
|
throw new JDownloaderError('Cannot start download without packageUUID!');
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.client.core.callAction('/linkgrabberv2/moveToDownloadlist', this.device.id, [linkIDs, [packageUUID]]);
|
||||||
Logger.success('Download started.');
|
Logger.success('Download started.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,15 @@ const main = async() => {
|
|||||||
await scraper.authenticate(credentials.kissasian);
|
await scraper.authenticate(credentials.kissasian);
|
||||||
|
|
||||||
const media = await scraper.getMediaData('https://kissasian.li/Drama/My-Roommate-is-a-Gumiho');
|
const media = await scraper.getMediaData('https://kissasian.li/Drama/My-Roommate-is-a-Gumiho');
|
||||||
|
|
||||||
await scraper.populateMediaDownloadURLs(media);
|
await scraper.populateMediaDownloadURLs(media);
|
||||||
|
|
||||||
|
await downloader.addLinks(media);
|
||||||
|
|
||||||
|
const crawledLinks = await downloader.getCrawledLinks(media.downloadURLs);
|
||||||
|
const renamedCrawledLinks = downloader.getRenamedCrawledLinks(crawledLinks, media);
|
||||||
|
await downloader.renameCrawledLinks(renamedCrawledLinks);
|
||||||
|
|
||||||
|
await downloader.startDownload(crawledLinks);
|
||||||
};
|
};
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user