Style fixes
							parent
							
								
									72f3b97ea1
								
							
						
					
					
						commit
						32409b91a7
					
				| 
						 | 
				
			
			@ -10,12 +10,12 @@ const selectors = require('./scripts/constants/css-selectors.js');
 | 
			
		|||
const {
 | 
			
		||||
  isStringAValidURL,
 | 
			
		||||
  urlExists,
 | 
			
		||||
  isF95URL,
 | 
			
		||||
  isF95URL
 | 
			
		||||
} = require('./scripts/urls-helper.js');
 | 
			
		||||
const scraper = require('./scripts/game-scraper.js');
 | 
			
		||||
const {
 | 
			
		||||
  prepareBrowser,
 | 
			
		||||
  preparePage,
 | 
			
		||||
  preparePage
 | 
			
		||||
} = require('./scripts/puppeteer-helper.js');
 | 
			
		||||
const searcher = require('./scripts/game-searcher.js');
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -161,7 +161,7 @@ module.exports.loadF95BaseData = async function () {
 | 
			
		|||
 | 
			
		||||
  // Go to latest update page and wait for it to load
 | 
			
		||||
  await page.goto(constURLs.F95_LATEST_UPDATES, {
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // Obtain engines (disc/online)
 | 
			
		||||
| 
						 | 
				
			
			@ -489,7 +489,7 @@ async function loginF95(browser, username, password) {
 | 
			
		|||
  await Promise.all([
 | 
			
		||||
    page.click(selectors.LOGIN_BUTTON), // Click on the login button
 | 
			
		||||
    page.waitForNavigation({
 | 
			
		||||
      waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
      waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
    }), // Wait for page to load
 | 
			
		||||
  ]);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ async function downloadMEGA(url, savepath) {
 | 
			
		|||
  const link = await page.$('a.host_link');
 | 
			
		||||
  await link.click();
 | 
			
		||||
  await page.goto(url, {
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
  }); // Go to the game page and wait until it loads
 | 
			
		||||
 | 
			
		||||
  // Obtain the URL after the redirect
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ async function downloadNOPY(url, savepath) {
 | 
			
		|||
  // Set the save path
 | 
			
		||||
  await page._client.send('Page.setDownloadBehavior', {
 | 
			
		||||
    behavior: 'allow',
 | 
			
		||||
    downloadPath: path.basename(path.dirname(savepath)), // Is a directory
 | 
			
		||||
    downloadPath: path.basename(path.dirname(savepath)) // It's a directory
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // Obtain the download button and click it
 | 
			
		||||
| 
						 | 
				
			
			@ -99,7 +99,7 @@ async function downloadNOPY(url, savepath) {
 | 
			
		|||
  // Await for all the connections to close
 | 
			
		||||
  await page.waitForNavigation({
 | 
			
		||||
    waitUntil: 'networkidle0',
 | 
			
		||||
    timeout: 0, // Disable timeout
 | 
			
		||||
    timeout: 0 // Disable timeout
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  // Close browser and page
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -103,7 +103,7 @@ class GameInfo {
 | 
			
		|||
      isMod: this.isMod,
 | 
			
		||||
      changelog: this.changelog,
 | 
			
		||||
      gameDir: this.gameDir,
 | 
			
		||||
      downloadInfo: this.downloadInfo,
 | 
			
		||||
      downloadInfo: this.downloadInfo
 | 
			
		||||
    };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,5 +28,5 @@ module.exports = Object.freeze({
 | 
			
		|||
  DOWNLOAD_LINKS_CONTAINER: 'span[style="font-size: 18px"]',
 | 
			
		||||
  SEARCH_THREADS_RESULTS_BODY: 'div.contentRow-main',
 | 
			
		||||
  SEARCH_THREADS_MEMBERSHIP: 'li > a:not(.username)',
 | 
			
		||||
  THREAD_LAST_CHANGELOG: 'div.bbCodeBlock-content > div:first-of-type',
 | 
			
		||||
  THREAD_LAST_CHANGELOG: 'div.bbCodeBlock-content > div:first-of-type'
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,5 +3,5 @@ module.exports = Object.freeze({
 | 
			
		|||
  F95_SEARCH_URL: 'https://f95zone.to/search',
 | 
			
		||||
  F95_LATEST_UPDATES: 'https://f95zone.to/latest',
 | 
			
		||||
  F95_LOGIN_URL: 'https://f95zone.to/login',
 | 
			
		||||
  F95_WATCHED_THREADS: 'https://f95zone.to/watched/threads',
 | 
			
		||||
  F95_WATCHED_THREADS: 'https://f95zone.to/watched/threads'
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			@ -31,7 +31,7 @@ module.exports.getGameInfo = async function (browser, url) {
 | 
			
		|||
  const page = await preparePage(browser); // Set new isolated page
 | 
			
		||||
  await page.setCookie(...shared.cookies); // Set cookies to avoid login
 | 
			
		||||
  await page.goto(url, {
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
  }); // Go to the game page and wait until it loads
 | 
			
		||||
 | 
			
		||||
  // It asynchronously searches for the elements and
 | 
			
		||||
| 
						 | 
				
			
			@ -81,7 +81,7 @@ module.exports.getGameVersionFromTitle = async function (browser, info) {
 | 
			
		|||
  const page = await preparePage(browser); // Set new isolated page
 | 
			
		||||
  await page.setCookie(...shared.cookies); // Set cookies to avoid login
 | 
			
		||||
  await page.goto(info.f95url, {
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
  }); // Go to the game page and wait until it loads
 | 
			
		||||
 | 
			
		||||
  // Get the title
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +322,7 @@ async function getGameDownloadLink(page) {
 | 
			
		|||
    'MIXDROP',
 | 
			
		||||
    'UPLOADHAVEN',
 | 
			
		||||
    'PIXELDRAIN',
 | 
			
		||||
    'FILESFM',
 | 
			
		||||
    'FILESFM'
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  // Supported OS platforms
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ module.exports.getSearchGameResults = async function (browser, gamename) {
 | 
			
		|||
  const page = await preparePage(browser); // Set new isolated page
 | 
			
		||||
  await page.setCookie(...shared.cookies); // Set cookies to avoid login
 | 
			
		||||
  await page.goto(constURLs.F95_SEARCH_URL, {
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
    waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
  }); // Go to the search form and wait for it
 | 
			
		||||
 | 
			
		||||
  // Explicitly wait for the required items to load
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +36,7 @@ module.exports.getSearchGameResults = async function (browser, gamename) {
 | 
			
		|||
  await Promise.all([
 | 
			
		||||
    page.click(selectors.SEARCH_BUTTON), // Execute search
 | 
			
		||||
    page.waitForNavigation({
 | 
			
		||||
      waitUntil: shared.WAIT_STATEMENT,
 | 
			
		||||
      waitUntil: shared.WAIT_STATEMENT
 | 
			
		||||
    }), // Wait for page to load
 | 
			
		||||
  ]);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,11 +18,11 @@ module.exports.prepareBrowser = async function () {
 | 
			
		|||
  if (shared.chromiumLocalPath) {
 | 
			
		||||
    browser = await puppeteer.launch({
 | 
			
		||||
      executablePath: shared.chromiumLocalPath,
 | 
			
		||||
      headless: !shared.debug, // Use GUI when debug = true
 | 
			
		||||
      headless: !shared.debug // Use GUI when debug = true
 | 
			
		||||
    });
 | 
			
		||||
  } else {
 | 
			
		||||
    browser = await puppeteer.launch({
 | 
			
		||||
      headless: !shared.debug, // Use GUI when debug = true
 | 
			
		||||
      headless: !shared.debug // Use GUI when debug = true
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
 | 
			
		||||
// Public modules from npm
 | 
			
		||||
const ky = require('ky-universal').create({
 | 
			
		||||
  throwHttpErrors: false,
 | 
			
		||||
  throwHttpErrors: false
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// Modules from file
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,7 +5,7 @@ const {
 | 
			
		|||
  getGameData,
 | 
			
		||||
  loadF95BaseData,
 | 
			
		||||
  getUserData,
 | 
			
		||||
  logout,
 | 
			
		||||
  logout
 | 
			
		||||
} = require("../app/index.js");
 | 
			
		||||
const GameDownload = require("../app/scripts/classes/game-download.js");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue