()
| 22 | await asyncio.sleep(random.uniform(1, 2)) |
| 23 | |
| 24 | async def main(): |
| 25 | proxy = random.choice(PROXIES) |
| 26 | user_agent = random.choice(USER_AGENTS) |
| 27 | |
| 28 | async with async_playwright() as p: |
| 29 | browser = await p.chromium.launch(proxy={"server": proxy}, headless=True) |
| 30 | context = await browser.new_context(user_agent=user_agent) |
| 31 | page = await context.new_page() |
| 32 | await stealth_async(page) # apply stealth |
| 33 | |
| 34 | await page.goto("https://example.com") |
| 35 | await human_like_interaction(page) |
| 36 | |
| 37 | content = await page.content() |
| 38 | print(content[:500]) # print first 500 chars |
| 39 | |
| 40 | await browser.close() |
| 41 | |
| 42 | if __name__ == "__main__": |
| 43 | asyncio.run(main()) |
no test coverage detected