(candidate: Any)
| 458 | |
| 459 | def _valid_url(candidate: Any) -> Optional[str]: |
| 460 | text = str(candidate or "").strip() |
| 461 | if text.startswith("http://") or text.startswith("https://"): |
| 462 | return text |
| 463 | return None |
| 464 | |
| 465 | for candidate in (doc_info.get("url"), doc_info.get("doc_url"), doc_info.get("link")): |
| 466 | valid = _valid_url(candidate) |
| 467 | if valid: |