40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
const puppeteer = require('puppeteer-core');
|
|
|
|
const EDGE_PATH = 'C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe';
|
|
|
|
async function run() {
|
|
const browser = await puppeteer.launch({
|
|
executablePath: EDGE_PATH,
|
|
headless: 'new',
|
|
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
});
|
|
|
|
const page = await browser.newPage();
|
|
await page.setViewport({ width: 1280, height: 800 });
|
|
|
|
page.on('response', async res => {
|
|
const url = res.url();
|
|
if (url.includes('waze.com') && (url.includes('routing') || url.includes('descartes') || url.includes('direction') || url.includes('alert') || url.includes('json') || url.includes('api'))) {
|
|
console.log(`[RES ${res.status()}] ${url.slice(0, 120)}`);
|
|
try {
|
|
const text = await res.text();
|
|
if (text.includes('alerts') || text.includes('POLICE') || text.includes('jam') || text.includes('results')) {
|
|
console.log(`>>> PAYLOAD HAS RELEVANT DATA! (${text.length} chars)`);
|
|
console.log(text.slice(0, 300));
|
|
}
|
|
} catch (e) {}
|
|
}
|
|
});
|
|
|
|
console.log('Navigating with origin and destination...');
|
|
await page.goto('https://www.waze.com/live-map/directions?to=ll.37.7880%2C-122.4075&from=ll.37.7749%2C-122.4194', {
|
|
waitUntil: 'networkidle2',
|
|
timeout: 30000
|
|
});
|
|
|
|
await new Promise(r => setTimeout(r, 6000));
|
|
await browser.close();
|
|
}
|
|
|
|
run().catch(console.error);
|