$npx -y skills add axoviq-ai/synthadoc --skill urlFetch and extract text from web URLs
| 1 | # URL Skill |
| 2 | |
| 3 | Fetches a web URL using `httpx`, strips navigation/script/style tags with |
| 4 | `BeautifulSoup`, and returns clean body text. PDF URLs are extracted with |
| 5 | `pypdf` (primary) and `pdfminer.six` (fallback). |
| 6 | |
| 7 | ## Setup |
| 8 | |
| 9 | ```bash |
| 10 | pip install httpx beautifulsoup4 |
| 11 | |
| 12 | # Optional — needed only if you ingest PDF URLs: |
| 13 | pip install pypdf pdfminer.six |
| 14 | ``` |
| 15 | |
| 16 | ## Standalone usage |
| 17 | |
| 18 | ```python |
| 19 | import asyncio |
| 20 | from synthadoc.skills.url.scripts.main import UrlSkill |
| 21 | |
| 22 | skill = UrlSkill() |
| 23 | |
| 24 | async def main(): |
| 25 | result = await skill.extract("https://example.com/article") |
| 26 | print(result.text) # clean body text |
| 27 | print(result.metadata) # {"url": "https://..."} |
| 28 | |
| 29 | asyncio.run(main()) |
| 30 | ``` |
| 31 | |
| 32 | `DomainBlockedException` is raised when the site returns HTTP 401, 403, or |
| 33 | 429. Catch it to log and skip the domain: |
| 34 | |
| 35 | ```python |
| 36 | from synthadoc.skills.base import DomainBlockedException |
| 37 | |
| 38 | try: |
| 39 | result = await skill.extract(url) |
| 40 | except DomainBlockedException as e: |
| 41 | print(f"Blocked: {e.domain} (HTTP {e.status_code})") |
| 42 | ``` |
| 43 | |
| 44 | ## When this skill is used |
| 45 | |
| 46 | - Source starts with `https://` or `http://` |
| 47 | - User intent contains: `fetch url`, `web page`, `website` |