Fix null quest values,

save unparsed activities
This commit is contained in:
PAlexanderFranklin 2023-11-12 15:47:26 -08:00
parent 1659fa65a9
commit a97f5361c4

View File

@ -16,7 +16,6 @@ async function main() {
await page.setRequestInterception(true) await page.setRequestInterception(true)
let usefulRequestHeaders = {} let usefulRequestHeaders = {}
let testForHeaders = () => !!usefulRequestHeaders["content-type"]
page.on("request", (request) => { page.on("request", (request) => {
let url = request.url() let url = request.url()
if (url.includes("getWebActivityFeed")) { if (url.includes("getWebActivityFeed")) {
@ -47,7 +46,11 @@ async function main() {
} }
}) })
await loginToUber(page, options, testForHeaders) await loginToUber(
page,
options,
() => !!usefulRequestHeaders["content-type"],
)
let uberJSON = [] let uberJSON = []
@ -82,7 +85,7 @@ async function main() {
).toISOString(), ).toISOString(),
pickupAddress: activity.tripMetaData?.pickupAddress, pickupAddress: activity.tripMetaData?.pickupAddress,
dropOffAddress: activity.tripMetaData?.dropOffAddress, dropOffAddress: activity.tripMetaData?.dropOffAddress,
total: Number(activity.formattedTotal), total: activity.formattedTotal,
type: activity.activityTitle, type: activity.activityTitle,
} }
} }
@ -90,6 +93,7 @@ async function main() {
// Trip or Share // Trip or Share
return await processTrip(activity, usefulRequestHeaders) return await processTrip(activity, usefulRequestHeaders)
} }
return { unparsedActivity: activity }
}) })
if (trips) { if (trips) {
let tripResults = await utils.settlePromises(trips) let tripResults = await utils.settlePromises(trips)