Puan
0
Çözümler
0
Kod:
from playwright.async_api import async_playwright
import asyncio,random
async def scrape(url):
async with async_playwright() as p:
br=await p.chromium.launch(headless=True)
pg=await br.new_page()
await pg.goto(url)
await pg.wait_for_selector('.item')
return [await e.inner_text() for e in await pg.query_selector_all('.item')]
asyncio.run(scrape('https://example.com'))
Anti-Bot
- playwright-stealth
- Rotating proxy: Brightdata, Oxylabs
- asyncio.sleep(random.uniform(1,3))
- fake-useragent rotasyonu