Merge pull request #16 from MillenniumEarl/deepsource-transform-a01d25e0

Format code with prettier
pull/15/head^2
Millennium Earl 2020-10-11 14:33:47 +02:00 committed by GitHub
commit 0fc086e964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -41,8 +41,10 @@ class GameDownload {
* @return {Promise<Boolean>} Result of the operation * @return {Promise<Boolean>} Result of the operation
*/ */
async download(path) { async download(path) {
if (this.link.includes("mega.nz")) return await downloadMEGA(this.link, path); if (this.link.includes("mega.nz"))
else if (this.link.includes("nopy.to")) return await downloadNOPY(this.link, path); return await downloadMEGA(this.link, path);
else if (this.link.includes("nopy.to"))
return await downloadNOPY(this.link, path);
} }
} }
module.exports = GameDownload; module.exports = GameDownload;
@ -83,9 +85,9 @@ async function downloadNOPY(url, savepath) {
await page.waitForSelector("#download"); await page.waitForSelector("#download");
// Set the save path // Set the save path
await page._client.send('Page.setDownloadBehavior', { await page._client.send("Page.setDownloadBehavior", {
behavior: 'allow', behavior: "allow",
downloadPath: path.basename(path.dirname(savepath)) // Is a directory downloadPath: path.basename(path.dirname(savepath)), // Is a directory
}); });
// Obtain the download button and click it // Obtain the download button and click it
@ -94,8 +96,8 @@ async function downloadNOPY(url, savepath) {
// Await for all the connections to close // Await for all the connections to close
await page.waitForNavigation({ await page.waitForNavigation({
waitUntil: 'networkidle0', waitUntil: "networkidle0",
timeout: 0 // Disable timeout timeout: 0, // Disable timeout
}); });
// Close browser and page // Close browser and page