ksvmuralidhar commited on
Commit
f6d006c
1 Parent(s): e71b6e8

Update scraper.py

Browse files
Files changed (1) hide show
  1. scraper.py +2 -0
scraper.py CHANGED
@@ -11,8 +11,10 @@ def scrape_text(url, n_words=15):
11
  try:
12
  driver = None
13
  logging.warning("Initiated Scraping")
 
14
  opts = FirefoxOptions()
15
  opts.add_argument("--headless")
 
16
  driver = webdriver.Firefox(options=opts)
17
  driver.set_page_load_timeout(60)
18
  driver.get(url)
 
11
  try:
12
  driver = None
13
  logging.warning("Initiated Scraping")
14
+ user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
15
  opts = FirefoxOptions()
16
  opts.add_argument("--headless")
17
+ opts.add_argument(f"user-agent={user_agent}")
18
  driver = webdriver.Firefox(options=opts)
19
  driver.set_page_load_timeout(60)
20
  driver.get(url)