This commit is contained in:
Justin Visser 2026-02-20 23:29:44 +01:00
parent 01454162bb
commit 4240ad38e2
2 changed files with 39 additions and 7 deletions

View file

@ -106,15 +106,13 @@ def parse_cluster_id_from_href(href: str | None) -> str | None:
if citation_for_view:
token = citation_for_view[0].strip()
if token:
if ":" in token:
return token.rsplit(":", 1)[-1] or None
return token
return f"cfv:{token}"
cluster = query.get("cluster")
if cluster:
token = cluster[0].strip()
if token:
return token
return f"cluster:{token}"
return None
@ -133,10 +131,10 @@ def parse_citation_count(parts: list[str]) -> int | None:
text = normalize_space(" ".join(parts))
if not text:
return 0
match = re.search(r"\d+", text)
if not match:
digits = re.sub(r"\D+", "", text)
if not digits:
return None
return int(match.group(0))
return int(digits)
def _parse_publication_row(row_html: str) -> tuple[PublicationCandidate | None, list[str]]: