MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / extract_pdf_url

Function extract_pdf_url

agents/master-coordinator/main.py:1088–1098  ·  view source on GitHub ↗

Extract the first PDF-like URL from arbitrary user text.

(text: Any)

Source from the content-addressed store, hash-verified

1086
1087
1088def extract_pdf_url(text: Any) -> Optional[str]:
1089 """Extract the first PDF-like URL from arbitrary user text."""
1090 for match in GENERIC_HTTP_URL_RE.finditer(str(text or "")):
1091 url = str(match.group("url") or "").strip().rstrip(".,);]\u3002\uff0c\uff1b")
1092 if not url:
1093 continue
1094 if "://" not in url:
1095 url = f"https://{url.lstrip('/')}"
1096 if looks_like_pdf_http_url(url):
1097 return url
1098 return None
1099
1100
1101def strip_pdf_url(text: Any) -> str:

Callers 1

Calls 1

looks_like_pdf_http_urlFunction · 0.85

Tested by

no test coverage detected