Files
job/scrap/index.ts
2026-04-20 16:27:09 +02:00

37 lines
974 B
TypeScript

import playwright from 'playwright';
function sleep(ms: number | undefined) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
(async () => {
const browser = await playwright.chromium.launch({headless : false});
const context = await browser.newContext();
const page = await context.newPage();
await context.route('**.jpg', route => route.abort());
await page.goto('https://www.google.com/maps/search/Software+company/@46.0463511,14.5023435,14z');
await page.click('span:has-text("Sprejmi")');
await page.waitForLoadState('networkidle');
console.log(await page.title());
// for div role="article"
// div class fontHeadlineSmall
// a contains spletno mesto get htef
// print name and url
// when you get to bottom scrool down with mouse to load more articles
for await (const line of console) {
console.log(line);
// wait for user enter to continue
break;
}
await context.close();
await browser.close();
})();