Skip to content

Commit

Permalink
small tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoestner committed Aug 15, 2024
1 parent c984b1e commit 63c08c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion folioflex/chatbot/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,16 @@ def scrape_selenium(
close_windows(sb, url)
try:
logger.info("wsj has specific landing page")
sb.driver.uc_click("(//p[contains(text(), 'View All')])[1]")
selector = "//p[contains(text(), 'View All')]/ancestor::a[1]"
url = sb.get_attribute(
selector=selector,
attribute="href",
by="xpath",
timeout=6,
hard_fail=True,
)
sb.driver.uc_open_with_reconnect(url, reconnect_time=wait_time)
close_windows(sb, url)
except Exception:
logger.error("WSJ probably flagged bot: returning None")
html_content = "<html><body><p>could not scrape wsj</p></body></html>"
Expand Down

0 comments on commit 63c08c3

Please sign in to comment.