Skip to content

Commit b3f743f

Browse files
authored
fix: Remove readabilipy dependency (#261)
1 parent 252fd28 commit b3f743f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ dependencies = [
3636
"watchdog>=6.0.0,<7.0.0",
3737
"slack_bolt>=1.23.0,<2.0.0",
3838
"markdownify>=1.0.0,<2.0.0",
39-
"readabilipy>=0.2.0,<1.0.0",
4039
"requests>=2.28.0,<3.0.0",
4140
"aiohttp>=3.8.0,<4.0.0",
4241
# Note: Always want the latest tzdata

src/strands_tools/http_request.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from urllib.parse import urlparse
2828

2929
import markdownify
30-
import readabilipy.simple_json
3130
import requests
3231
from aws_requests_auth.aws_auth import AWSRequestsAuth
3332
from requests.adapters import HTTPAdapter
@@ -192,21 +191,17 @@
192191

193192

194193
def extract_content_from_html(html: str) -> str:
195-
"""Extract and convert HTML content to Markdown format.
194+
"""Convert HTML content to Markdown format.
196195
197196
Args:
198197
html: Raw HTML content to process
199198
200199
Returns:
201-
Simplified markdown version of the content, or original HTML if conversion fails
200+
Markdown version of the content, or original HTML if conversion fails
202201
"""
203202
try:
204-
ret = readabilipy.simple_json.simple_json_from_html_string(html, use_readability=True)
205-
if not ret.get("content"):
206-
return html
207-
208203
content = markdownify.markdownify(
209-
ret["content"],
204+
html,
210205
heading_style=markdownify.ATX,
211206
)
212207
return content
@@ -604,7 +599,7 @@ def http_request(tool: ToolUse, **kwargs: Any) -> ToolResult:
604599
http_request(
605600
method="GET",
606601
url="https://example.com/article",
607-
convert_to_markdown=True, # Converts HTML content to readable markdown
602+
convert_to_markdown=True, # Converts HTML content to markdown
608603
)
609604
```
610605

0 commit comments

Comments
 (0)