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

Function _pick_download_referer

agents/reading-agent/main.py:1715–1726  ·  view source on GitHub ↗
(paper: Dict[str, Any], pdf_url: str)

Source from the content-addressed store, hash-verified

1713
1714def _pick_download_referer(paper: Dict[str, Any], pdf_url: str) -> Optional[str]:
1715 source_urls = _collect_source_page_urls(paper)
1716 if not source_urls:
1717 return None
1718
1719 pdf_host = (urlparse(_clean_text(pdf_url)).netloc or "").lower()
1720 if pdf_host:
1721 for source_url in source_urls:
1722 if (urlparse(source_url).netloc or "").lower() == pdf_host:
1723 return source_url
1724
1725 return source_urls[0]
1726
1727
1728def _build_pdf_download_candidates(paper: Dict[str, Any], primary_pdf_url: str) -> List[str]:
1729 candidates: List[str] = []

Callers 1

Calls 2

_clean_textFunction · 0.70

Tested by

no test coverage detected