From 7ef3b56f78e3075db8eb3a643997931d80b6345f Mon Sep 17 00:00:00 2001 From: PAlexanderFranklin Date: Wed, 30 Aug 2023 17:57:49 -0700 Subject: [PATCH] Add some auto typing --- src/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index e3b9f79..9564b8c 100644 --- a/src/index.js +++ b/src/index.js @@ -12,9 +12,7 @@ async function main() { executablePath: "/usr/bin/chromium", }) try { - console.log("Opened Browser") const page = await browser.newPage() - console.log("Opened Page") await page.setRequestInterception(true) let usefulRequestHeaders = {} @@ -33,24 +31,27 @@ async function main() { url.endsWith(".jpg") || url.endsWith(".ico") ) { + console.log("aborted: ", url) request.abort() } else { - console.log("request url", url) + console.log("requested", url) request.continue() } }) page.on("response", async (response) => { const request = response.request() - if (request.url().includes("desiredrequest.json")) { - const text = await response.text() - console.log(text) + if (request.url().includes("getWebActivityFeed")) { + console.log(response) } }) await page.goto("https://drivers.uber.com/earnings/activities") console.log("Went to Page") + await page.waitForSelector(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`) + await page.type(`input[id="PHONE_NUMBER_or_EMAIL_ADDRESS"]`, "1234567891") + for (let i = 0; i < 100; i++) { await sleep(500) if (usefulRequestHeaders["content-type"]) { @@ -62,6 +63,7 @@ async function main() { } } console.log("after sleep loop") + await sleep(50000) } catch (err) { console.error("Critical failure", err) } finally {