Solved (probably) timeout issue

pull/20/head
samuele.berlusconi 2020-10-14 15:12:35 +02:00
parent 54b91f92bc
commit f7ff5f3c26
5 changed files with 34 additions and 812 deletions

View File

@ -486,10 +486,12 @@ async function loginF95(browser, username, password) {
await page.type(selectors.USERNAME_INPUT, username); // Insert username
await page.type(selectors.PASSWORD_INPUT, password); // Insert password
await page.click(selectors.LOGIN_BUTTON); // Click on the login button
await page.waitForNavigation({
waitUntil: shared.WAIT_STATEMENT,
}); // Wait for page to load
await Promise.all([
page.click(selectors.LOGIN_BUTTON), // Click on the login button
page.waitForNavigation({
waitUntil: shared.WAIT_STATEMENT
}) // Wait for page to load
]);
// Prepare result
let result = new LoginResult();

View File

@ -32,10 +32,12 @@ module.exports.getSearchGameResults = async function (browser, gamename) {
await page.type(selectors.SEARCH_FORM_TEXTBOX, gamename); // Type the game we desire
await page.click(selectors.TITLE_ONLY_CHECKBOX); // Select only the thread with the game in the titles
await page.click(selectors.SEARCH_BUTTON); // Execute search
await page.waitForNavigation({
await Promise.all([
page.click(selectors.SEARCH_BUTTON), // Execute search
page.waitForNavigation({
waitUntil: shared.WAIT_STATEMENT,
}); // Wait for page to load
}) // Wait for page to load
]);
// Select all conversation titles
let resultsThread = await page.$$(selectors.SEARCH_THREADS_RESULTS_BODY);

View File

@ -14,10 +14,17 @@ const shared = require("./shared.js");
*/
module.exports.prepareBrowser = async function () {
// Create a headless browser
let browser = await puppeteer.launch({
let browser = null;
if (shared.chromiumLocalPath) {
browser = await puppeteer.launch({
executablePath: shared.chromiumLocalPath,
headless: !shared.debug, // Use GUI when debug = true
});
} else {
browser = await puppeteer.launch({
headless: !shared.debug, // Use GUI when debug = true
});
}
return browser;
};

795
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,6 @@ const GameDownload = require("../app/scripts/classes/game-download.js");
debug(true);
main();
//downloadGameNOPY();
//downloadGameMEGA();
async function main() {
@ -19,7 +18,7 @@ async function main() {
if (loginResult.success) {
await loadF95BaseData();
let gameData = await getGameData("employee benefits", false);
let gameData = await getGameData("brothel king", false);
console.log(gameData);
// let userData = await getUserData();
@ -28,15 +27,6 @@ async function main() {
logout();
}
async function downloadGameNOPY() {
let gd = new GameDownload();
gd.hosting = "NOPY";
gd.link = "https://nopy.to/50jmNQbo/Kingdom_of_Deception-pc0.10.8.zip";
let savepath = join(__dirname, "Kingdom_of_Deception-pc0.10.8.zip");
let result = await gd.download(savepath);
console.log(result);
}
async function downloadGameMEGA() {
let gd = new GameDownload();
gd.hosting = "NOPY";