Main script file completes the job.
This commit is contained in:
		| @@ -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.'); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user