MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / extract_urls

Function extract_urls

optillm/plugins/readurls_plugin.py:11–25  ·  view source on GitHub ↗
(text: str)

Source from the content-addressed store, hash-verified

9SLUG = "readurls"
10
11def 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
27def fetch_webpage_content(url: str, max_length: int = 100000, verify_ssl: Optional[bool] = None, cert_path: Optional[str] = None) -> str:
28 try:

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected