Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,6 +48,12 @@ def scrape_single_url(url):
|
|
| 48 |
args=["--disable-blink-features=AutomationControlled"]
|
| 49 |
)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
# 3. Inject "Real Human" User-Agent (Windows Chrome)
|
| 52 |
# This prevents the "N/A" error by tricking Instagram
|
| 53 |
context_args = {
|
|
|
|
| 48 |
args=["--disable-blink-features=AutomationControlled"]
|
| 49 |
)
|
| 50 |
|
| 51 |
+
context = browser.new_context(
|
| 52 |
+
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
|
| 53 |
+
viewport={"width": 1280, "height": 720},
|
| 54 |
+
storage_state=SESSION_FILE if os.path.exists(SESSION_FILE) else None
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
# 3. Inject "Real Human" User-Agent (Windows Chrome)
|
| 58 |
# This prevents the "N/A" error by tricking Instagram
|
| 59 |
context_args = {
|