Publication date extractor for Italian newspaper pages. A FastAPI microservice that accepts a URL or raw HTML and returns the publication date in ISO 8601 format, using a generic parsing chain for most sites and domain-specific extractors to handle edge cases.
POST /extract— accept aurlor rawhtmlbody, get back the publication date (ornull).GET /domain_eval/GET /full_eval— score extraction accuracy against the ground-truth dataset.- 8-strategy generic parsing chain (published_time metadata, OpenGraph/JSON-LD microdata,
<time>tags, URL date patterns, etc.) plus domain-specific extractors for ~33 sites. - Layered fetch pipeline (curl_cffi TLS impersonation → headless Chromium → search-engine snippet fallbacks) to bypass bot detection.
Local development uses the py launcher with an editable install (no venv):
py -m pip install -e ".[dev]"
uvicorn datario.main:app --reload --port 8000Or via Docker:
docker compose up --buildThe API will be available at http://localhost:8000.
Debug prints are off by default, to enable them uncomment the debug=true line in .config.
To add more domain-specific extractors, create a new class in datario/extractors/ and import it in datario/extractors/extractor_factory/__init__.py. Also update
__DOMAIN_EXCEPTIONS in datario/extractors/BaseExtractor.py.
Either url or html must be provided (at least one).
{ "url": "https://www.ansa.it/sito/notizie/2026/07/22/..." }{ "html": "<html>...<meta property=\"article:published_time\" content=\"2026-07-22T07:48:00.000Z\"/>...</html>" }Response:
{ "date": "2026-07-22T07:48:00+00:00" }date is null when no publication date can be found. Errors: 400 malformed URL, 502 fetch failure, 500 extraction failure.
Accuracy for a single domain from the ground-truth dataset.
Overall accuracy across all domains. Concurrency is capped at 5 domains to avoid 403s.
src/datario/gs_data.json holds 218 domain keys with 3 article URLs each, mapping each URL to its expected date.
The HTTP eval endpoints hit the live network. For iteration, prefer the offline eval loop against the committed HTML cache in src/datario/html/:
py scripts/fetch_html.py # cache article HTML for all gs_data URLs
py scripts/eval_local.py # full eval over the cache
py scripts/eval_local.py www.ansa.it # single domain
py scripts/eval_local.py --url <article> # single URL, detailed output
py scripts/inspect_domain.py www.ansa.it # dump cached HTML metadata for a domainAfter regenerating the cache, keep url_to_cache.json and src/datario/html/ in sync:
py scripts/map_urls_to_cache.py
py scripts/prune_html_cache.pysrc/datario/
main.py — FastAPI app + eval endpoints
models.py — request/response schemas
fetcher.py — layered fetch: curl_cffi → Playwright → Startpage → DuckDuckGo Lite
gs_data.json — ground-truth dates for eval
html/ — cached article HTML for offline eval (not shipped in Docker)
extractors/ — BaseExtractor fallback chain + ~30 domain-specific subclasses
scripts/ — local eval and cache-management tooling
See LICENSE.