Spaces:
Sleeping
Sleeping
Download browser.py from dimdimm/crawling-datas: direct link, hf CLI and curl.
- Browser
- Download file 479 Bytes
-
https://huggingface.co/spaces/dimdimm/crawling-datas/resolve/main/browser.py
- Command line
-
hf download hf://spaces/dimdimm/crawling-datas/browser.py
-
curl -L -o browser.py https://huggingface.co/spaces/dimdimm/crawling-datas/resolve/main/browser.py
479 Bytes
| from playwright.sync_api import sync_playwright | |
| def get_browser(): | |
| p = sync_playwright().start() | |
| browser = p.chromium.launch( | |
| headless=True, | |
| args=[ | |
| "--disable-blink-features=AutomationControlled" | |
| ] | |
| ) | |
| context = browser.new_context( | |
| user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120 Safari/537.36", | |
| viewport={"width": 1280, "height": 800} | |
| ) | |
| return p, browser, context |