(paper: Dict[str, Any], pdf_url: str)
| 1713 | |
| 1714 | def _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 | |
| 1728 | def _build_pdf_download_candidates(paper: Dict[str, Any], primary_pdf_url: str) -> List[str]: |
| 1729 | candidates: List[str] = [] |
no test coverage detected