temp commit

This commit is contained in:
Justin Visser 2026-02-26 12:54:19 +01:00
parent 8760f27b51
commit 0e9e49df16
193 changed files with 23228 additions and 935 deletions

View file

@ -63,7 +63,10 @@ def _extract_explicit_doi(text: str | None) -> str | None:
def _publication_doi(item: PublicationListItem | UnreadPublicationItem) -> str | None:
stored = normalize_doi(item.doi)
stored = None
if getattr(item, "display_identifier", None) and item.display_identifier.kind == "doi":
stored = normalize_doi(item.display_identifier.value)
explicit_doi = (
_extract_explicit_doi(item.pub_url)
or _extract_explicit_doi(item.venue_text)
@ -169,9 +172,11 @@ async def _fetch_unpaywall_payload_by_doi(
email: str,
) -> dict | None:
await wait_for_unpaywall_slot(min_interval_seconds=settings.unpaywall_min_interval_seconds)
headers = {"User-Agent": f"scholar-scraper/1.0 (mailto:{email})"}
response = await client.get(
UNPAYWALL_URL_TEMPLATE.format(doi=doi),
params={"email": email},
headers=headers,
)
if response.status_code != 200:
return None
@ -427,7 +432,8 @@ async def resolve_publication_oa_outcomes(
timeout_seconds = max(float(settings.unpaywall_timeout_seconds), 0.5)
targets = _resolution_targets(items)[: max(int(settings.unpaywall_max_items_per_request), 0)]
async with httpx.AsyncClient(timeout=timeout_seconds) as client:
headers = {"User-Agent": f"scholar-scraper/1.0 (mailto:{email})"}
async with httpx.AsyncClient(timeout=timeout_seconds, follow_redirects=True, headers=headers) as client:
outcomes = await _resolve_outcomes_with_client(
client=client,
targets=targets,