Baskar2005 commited on
Commit
97fb649
·
verified ·
1 Parent(s): 44e38e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
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 = {