(paper: Dict[str, Any], *keys: str)
| 943 | |
| 944 | |
| 945 | def _get_first_url(paper: Dict[str, Any], *keys: str) -> str: |
| 946 | metadata = paper.get("metadata") |
| 947 | if not isinstance(metadata, dict): |
| 948 | metadata = {} |
| 949 | |
| 950 | for key in keys: |
| 951 | for container in (paper, metadata): |
| 952 | candidate = _clean_text(container.get(key)) |
| 953 | if candidate.startswith("http://") or candidate.startswith("https://"): |
| 954 | return candidate |
| 955 | return "" |
| 956 | |
| 957 | |
| 958 | def _get_direct_pdf_url(paper: Dict[str, Any]) -> str: |
no test coverage detected