Extract the first Google Scholar profile URL from arbitrary user text.
(text: Any)
| 1053 | |
| 1054 | |
| 1055 | def extract_google_scholar_url(text: Any) -> Optional[str]: |
| 1056 | """Extract the first Google Scholar profile URL from arbitrary user text.""" |
| 1057 | match = GOOGLE_SCHOLAR_URL_RE.search(str(text or "")) |
| 1058 | if not match: |
| 1059 | return None |
| 1060 | url = str(match.group("url") or "").strip().rstrip(".,);]\u3002\uff0c\uff1b") |
| 1061 | if not url: |
| 1062 | return None |
| 1063 | if "://" not in url: |
| 1064 | url = f"https://{url.lstrip('/')}" |
| 1065 | return url |
| 1066 | |
| 1067 | |
| 1068 | def looks_like_pdf_http_url(url: Any) -> bool: |
no outgoing calls
no test coverage detected