Add1E commited on
Commit
791ca65
·
verified ·
1 Parent(s): fa60cb9

Update trend_crawl2.py

Browse files
Files changed (1) hide show
  1. trend_crawl2.py +3 -4
trend_crawl2.py CHANGED
@@ -21,6 +21,7 @@ def setup_driver():
21
  options.add_argument('--headless')
22
  options.add_argument('--no-sandbox')
23
  options.add_argument('--disable-dev-shm-usage')
 
24
  wd = webdriver.Chrome(options=options)
25
  return wd
26
 
@@ -34,10 +35,8 @@ def click_and_scrape(driver, url):
34
  try:
35
  # Wait for the ul element with the specific aria-label to load
36
  ul_element = WebDriverWait(driver, 20).until(
37
- EC.presence_of_element_located((
38
- By.XPATH,
39
- "//ul[@aria-label='Kategorie']"
40
- ))
41
  )
42
  li_elements = ul_element.find_elements(By.TAG_NAME, "li")
43
  except Exception as e:
 
21
  options.add_argument('--headless')
22
  options.add_argument('--no-sandbox')
23
  options.add_argument('--disable-dev-shm-usage')
24
+ options.add_argument("--lang=de")
25
  wd = webdriver.Chrome(options=options)
26
  return wd
27
 
 
35
  try:
36
  # Wait for the ul element with the specific aria-label to load
37
  ul_element = WebDriverWait(driver, 20).until(
38
+ EC.presence_of_element_located((By.XPATH, "//ul[contains(@aria-label, 'Kategorie') or contains(@aria-label, 'Category')]"))
39
+ )
 
 
40
  )
41
  li_elements = ul_element.find_elements(By.TAG_NAME, "li")
42
  except Exception as e: