Htmldate operates by sifting through HTML markup and if necessary text
elements. It features the following heuristics:
Markup in header: Common patterns are used to identify relevant
elements (e.g. link and meta elements) including Open Graph
protocol attributes.
HTML code: The whole document is searched for structural markers
like abbr or time elements and a series of attributes (e.g.
postmetadata).
Bare HTML content: Heuristics are run on text and markup:
In fast mode the HTML page is cleaned and precise patterns are
targeted.
In extensive mode all potential dates are collected and a
disambiguation algorithm determines the best one.
Finally, the output is validated and converted to the chosen format.
Performance
1000 web pages containing identifiable dates (as of 2026-10-01 on Python 3.13)
Python Package
Precision
Recall
Accuracy
F-Score
Time
articleDateExtractor 0.20
0.846
0.745
0.656
0.792
6.4x
date_guesser 2.1.4
0.832
0.611
0.544
0.705
20x
goose3 3.1.22
0.930
0.569
0.546
0.706
26x
htmldate[all] 1.11.0 (fast)
0.924
0.929
0.863
0.926
1x
htmldate[all] 1.11.0 (extensive)
0.908
0.993
0.903
0.949
1.8x
newspaper4k 0.9.6
0.912
0.728
0.680
0.810
4.3x
news-please 1.6.16
0.845
0.778
0.681
0.810
52x
For the complete results and explanations see evaluation
page.
Installation
Htmldate is tested on Linux, macOS and Windows systems, it is compatible
with Python 3.10 upwards. It can notably be installed with pip (pip3
where applicable) from the PyPI package repository:
pip install htmldate
(optionally) pip install htmldate[speed]
The last version to support Python 3.6 and 3.7 is htmldate==1.8.1; for
Python 3.8 and 3.9 use the 1.9.x series.
Documentation
For more details on installation, Python & CLI usage, please refer to
the documentation:
htmldate.readthedocs.io
Versions prior to v1.8.0 are under GPLv3+ license.
Context and contributions
Initially launched to create text databases for research purposes
at the Berlin-Brandenburg Academy of Sciences (DWDS and ZDL units),
this project continues to be maintained but its future development
depends on community support.
If you value this software or depend on it for your product, consider
sponsoring it and contributing to its codebase. Your support
will help maintain and enhance this package.
Visit the Contributing page
for more information.
Reach out via the software repository or the contact page
for inquiries, collaborations, or feedback.
@article{barbaresi-2020-htmldate,
title = {{htmldate: A Python package to extract publication dates from web pages}},
author = "Barbaresi, Adrien",
journal = "Journal of Open Source Software",
volume = 5,
number = 51,
pages = 2439,
url = {https://doi.org/10.21105/joss.02439},
publisher = {The Open Journal},
year = 2020,
}
Use together with htmldate: extensions, drivers, servers and companion tools.
lxmlPythie’s Index: 84Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API.445.4M downloads/mo
trafilaturaPythie’s Index: 88Python & Command-line tool to gather text and metadata on the Web: Crawling, scraping, extraction, output as CSV, JSON, HTML, MD, TXT, XML.17.4M downloads/mo