| 9 | SLUG = "readurls" |
| 10 | |
| 11 | def extract_urls(text: str) -> List[str]: |
| 12 | # Updated regex pattern to be more precise |
| 13 | url_pattern = re.compile(r'https?://[^\s\'"]+') |
| 14 | |
| 15 | # Find all matches |
| 16 | urls = url_pattern.findall(text) |
| 17 | |
| 18 | # Clean up the URLs |
| 19 | cleaned_urls = [] |
| 20 | for url in urls: |
| 21 | # Remove trailing punctuation and quotes |
| 22 | url = re.sub(r'[,\'\"\)\]]+$', '', url) |
| 23 | cleaned_urls.append(url) |
| 24 | |
| 25 | return cleaned_urls |
| 26 | |
| 27 | def fetch_webpage_content(url: str, max_length: int = 100000, verify_ssl: Optional[bool] = None, cert_path: Optional[str] = None) -> str: |
| 28 | try: |