MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / fix_url

Function fix_url

AskAgent/python/data_loading/rss2schema.py:44–66  ·  view source on GitHub ↗

Ensure URL is properly formatted. Args: url: Input URL Returns: Fixed URL

(url: str)

Source from the content-addressed store, hash-verified

42 return element.text or ""
43
44def fix_url(url: str) -> str:
45 """
46 Ensure URL is properly formatted.
47
48 Args:
49 url: Input URL
50
51 Returns:
52 Fixed URL
53 """
54 if not url:
55 return ""
56
57 url = url.strip()
58
59 # Add missing scheme if needed
60 if url and not (url.startswith('http://') or url.startswith('https://')):
61 if url.startswith('//'):
62 url = 'https:' + url
63 else:
64 url = 'https://' + url
65
66 return url
67
68def extract_duration(duration_str: str) -> str | None:
69 """

Callers 4

extract_guidFunction · 0.85
extract_url_candidatesFunction · 0.85
parse_rss_2_0Function · 0.85
parse_atomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected