Spaces:
Running
Running
Update tools/scrape_text.py
Browse files- tools/scrape_text.py +11 -3
tools/scrape_text.py
CHANGED
@@ -40,12 +40,20 @@ def scrape_text(driver, selector="p", extract_table=False):
|
|
40 |
return f"Failed to scrape with selector {selector}: {str(e)}"
|
41 |
|
42 |
# Register the tool
|
43 |
-
|
44 |
name="scrape_text",
|
45 |
description="Scrapes text or table data from elements matching a CSS selector on the current page.",
|
46 |
inputs={
|
47 |
-
"selector": {
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
},
|
50 |
output_type="str",
|
51 |
function=scrape_text
|
|
|
40 |
return f"Failed to scrape with selector {selector}: {str(e)}"
|
41 |
|
42 |
# Register the tool
|
43 |
+
scrape_text_tool = Tool(
|
44 |
name="scrape_text",
|
45 |
description="Scrapes text or table data from elements matching a CSS selector on the current page.",
|
46 |
inputs={
|
47 |
+
"selector": {
|
48 |
+
"type": "str",
|
49 |
+
"default": "p",
|
50 |
+
"description": "CSS selector to target elements"
|
51 |
+
},
|
52 |
+
"extract_table": {
|
53 |
+
"type": "bool",
|
54 |
+
"default": False,
|
55 |
+
"description": "If True, extract table data as JSON"
|
56 |
+
}
|
57 |
},
|
58 |
output_type="str",
|
59 |
function=scrape_text
|