Main script file completes the job.

This commit is contained in:
moonstar-x 2021-06-12 01:36:06 -05:00
parent 7549e5b3f8
commit 20e304aa97
2 changed files with 15 additions and 6 deletions

View File

@ -88,17 +88,19 @@ class JDownloaderClient {
}
async startDownload(crawledLinks = []) {
if (!crawledLinks.packageUUID) {
throw new JDownloaderError('Cannot start download without packageUUID!');
}
const linkIDs = crawledLinks.map((link) => link.uuid);
if (linkIDs.length < 1) {
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.');
}
}

View File

@ -23,8 +23,15 @@ const main = async() => {
await scraper.authenticate(credentials.kissasian);
const media = await scraper.getMediaData('https://kissasian.li/Drama/My-Roommate-is-a-Gumiho');
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();