Extract the first plausible personal homepage URL from arbitrary user text.
(text: Any)
| 1172 | |
| 1173 | |
| 1174 | def extract_homepage_url(text: Any) -> Optional[str]: |
| 1175 | """Extract the first plausible personal homepage URL from arbitrary user text.""" |
| 1176 | for match in GENERIC_HTTP_URL_RE.finditer(str(text or "")): |
| 1177 | url = str(match.group("url") or "").strip().rstrip(".,);]\u3002\uff0c\uff1b") |
| 1178 | if not url: |
| 1179 | continue |
| 1180 | if "://" not in url: |
| 1181 | url = f"https://{url.lstrip('/')}" |
| 1182 | if looks_like_homepage_url(url): |
| 1183 | return url |
| 1184 | return None |
| 1185 | |
| 1186 | |
| 1187 | def strip_bootstrap_urls(text: Any) -> str: |
no test coverage detected