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