Add a URL to the scraping pipeline.
(url: str)
| 16 | |
| 17 | @tool |
| 18 | def add_url(url: str) -> Dict[str, Any]: |
| 19 | """Add a URL to the scraping pipeline.""" |
| 20 | # Validate URL format |
| 21 | try: |
| 22 | result = urlparse(url) |
| 23 | if not all([result.scheme, result.netloc]): |
| 24 | return {"success": False, "error": "Invalid URL format"} |
| 25 | |
| 26 | # Check if URL starts with http/https |
| 27 | if result.scheme not in ['http', 'https']: |
| 28 | return {"success": False, "error": "URL must start with http:// or https://"} |
| 29 | |
| 30 | return { |
| 31 | "success": True, |
| 32 | "url": url, |
| 33 | "message": f"Successfully added {url} to the pipeline" |
| 34 | } |
| 35 | except Exception as e: |
| 36 | return {"success": False, "error": str(e)} |
| 37 | |
| 38 | @tool |
| 39 | def remove_url(url: str) -> Dict[str, Any]: |
nothing calls this directly
no outgoing calls
no test coverage detected