Add some things lol
This commit is contained in:
parent
51802893b1
commit
15cc89bb00
51
index.js
51
index.js
@ -14,12 +14,12 @@ const settlePromises = async (promiseArray) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
const browser = await puppeteer.launch({
|
||||||
|
headless: false,
|
||||||
|
ignoreHTTPSErrors: true,
|
||||||
|
executablePath: "/usr/bin/chromium",
|
||||||
|
})
|
||||||
try {
|
try {
|
||||||
const browser = await puppeteer.launch({
|
|
||||||
headless: false,
|
|
||||||
ignoreHTTPSErrors: true,
|
|
||||||
executablePath: "/usr/bin/chromium",
|
|
||||||
})
|
|
||||||
console.log("Opened Browser")
|
console.log("Opened Browser")
|
||||||
const page = await browser.newPage()
|
const page = await browser.newPage()
|
||||||
console.log("Opened Page")
|
console.log("Opened Page")
|
||||||
@ -28,41 +28,48 @@ async function main() {
|
|||||||
let usefulRequestHeaders = {}
|
let usefulRequestHeaders = {}
|
||||||
page.on("request", (request) => {
|
page.on("request", (request) => {
|
||||||
let url = request.url()
|
let url = request.url()
|
||||||
console.log("request url", url)
|
|
||||||
if (url.includes("getWebActivityFeed")) {
|
if (url.includes("getWebActivityFeed")) {
|
||||||
usefulRequestHeaders = { ...request.headers() }
|
usefulRequestHeaders = { ...request.headers() }
|
||||||
console.log("hello!", usefulRequestHeaders)
|
console.log("hello!", usefulRequestHeaders)
|
||||||
}
|
}
|
||||||
request.continue()
|
if (request.isInterceptResolutionHandled()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
url.endsWith(".png") ||
|
||||||
|
url.endsWith(".jpg") ||
|
||||||
|
url.endsWith(".ico")
|
||||||
|
) {
|
||||||
|
request.abort()
|
||||||
|
} else {
|
||||||
|
console.log("request url", 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)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await page.goto("https://drivers.uber.com/earnings/activities")
|
await page.goto("https://drivers.uber.com/earnings/activities")
|
||||||
console.log("Went to Page")
|
console.log("Went to Page")
|
||||||
|
|
||||||
await page.waitForSelector('input[aria-label="Select a date range."]')
|
for (let i = 0; i < 100; i++) {
|
||||||
console.log("We're in.", usefulRequestHeaders)
|
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
await sleep(500)
|
await sleep(500)
|
||||||
if (usefulRequestHeaders["content-type"]) {
|
if (usefulRequestHeaders["content-type"]) {
|
||||||
console.log("success")
|
console.log("success")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if (i == 9) {
|
if (i == 99) {
|
||||||
throw "fail"
|
throw "fail"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("after sleep loop")
|
console.log("after sleep loop")
|
||||||
|
|
||||||
const response = await fetch("https://www.google.com", {
|
|
||||||
method: "POST",
|
|
||||||
headers: usefulRequestHeaders,
|
|
||||||
body: JSON.stringify({ Request }),
|
|
||||||
})
|
|
||||||
|
|
||||||
// if (response.ok) {
|
|
||||||
// console.log(await response.json());
|
|
||||||
// }
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Critical failure", err)
|
console.error("Critical failure", err)
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user