RalphThings commited on
Commit
bb7b849
·
verified ·
1 Parent(s): feb5487

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -46,8 +46,9 @@ def find_non_commutative(table: dict) -> list:
46
  return sorted(bad)
47
 
48
  @tool
49
- def libretext_extract(url: str, selector: str) -> str:
50
- """Extract text via CSS selector"""
 
51
  r = requests.get(url, timeout=10)
52
  soup = BeautifulSoup(r.text, "html.parser")
53
  return soup.select_one(selector).get_text(strip=True)
 
46
  return sorted(bad)
47
 
48
  @tool
49
+ def libretext_extract(query: str) -> str:
50
+ """Input 'url||css_selector', returns the first matching element's text"""
51
+ url, selector = query.split("||", 1)
52
  r = requests.get(url, timeout=10)
53
  soup = BeautifulSoup(r.text, "html.parser")
54
  return soup.select_one(selector).get_text(strip=True)