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

Function _get_direct_pdf_url

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

Source from the content-addressed store, hash-verified

956
957
958def _get_direct_pdf_url(paper: Dict[str, Any]) -> str:
959 candidates = [
960 paper.get("pdf_url"),
961 paper.get("url"),
962 paper.get("paper_url"),
963 paper.get("doi_url"),
964 paper.get("openreview_url"),
965 (paper.get("metadata") or {}).get("pdf_url"),
966 (paper.get("metadata") or {}).get("url"),
967 (paper.get("metadata") or {}).get("link"),
968 (paper.get("metadata") or {}).get("paper_url"),
969 (paper.get("metadata") or {}).get("doi_url"),
970 (paper.get("metadata") or {}).get("openreview_url"),
971 ]
972
973 for candidate in candidates:
974 text = _clean_text(candidate)
975 if _looks_like_pdf_url(text):
976 return text
977
978 arxiv_id = _clean_text(paper.get("arxiv_id"))
979 if arxiv_id:
980 return f"https://arxiv.org/pdf/{arxiv_id}.pdf"
981 return ""
982
983
984def _build_resource_items(paper: Dict[str, Any], response_language: str = "zh") -> List[Tuple[str, str]]:

Callers 4

_build_resource_itemsFunction · 0.85
_daily_note_entryFunction · 0.85
generate_reading_reportFunction · 0.85

Calls 3

_looks_like_pdf_urlFunction · 0.85
getMethod · 0.80
_clean_textFunction · 0.70

Tested by

no test coverage detected