Skip to main content

Htmldate: Find the Publication Date of Web Pages

Python package Python versions Documentation Status Code Coverage Downloads JOSS article reference DOI: 10.21105/joss.02439


Htmldate Logo

Find original and updated publication dates of any web page. It is often not possible to do it using just the URL or the server response.

On the command-line or with Python, all the steps needed from web page download to HTML parsing, scraping, and text analysis are included.

The package is used in production on millions of documents and integrated into thousands of projects.

In a nutshell


Demo as GIF image

With Python

>>> from htmldate import find_date
>>> find_date('http://blog.python.org/2016/12/python-360-is-now-available.html')
'2016-12-23'

On the command-line

$ htmldate -u http://blog.python.org/2016/12/python-360-is-now-available.html
'2016-12-23'

Features

  • Flexible input: URLs, HTML files, or HTML trees can be used as input (including batch processing).
  • Customizable output: Any date format (defaults to ISO 8601 YMD).
  • Detection of both original and updated dates.
  • Multilingual.
  • Compatible with Python 3.10 and later.

How it works

Htmldate operates by sifting through HTML markup and if necessary text elements. It features the following heuristics:

  1. Markup in header: Common patterns are used to identify relevant elements (e.g. link and meta elements) including Open Graph protocol attributes.
  2. HTML code: The whole document is searched for structural markers like abbr or time elements and a series of attributes (e.g. postmetadata).
  3. 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-06-01 on Python 3.13)

Python Package Precision Recall Accuracy F-Score Time
articleDateExtractor 0.20 0.846 0.745 0.656 0.792 3x
date_guesser 2.1.4 0.832 0.611 0.544 0.705 11x
goose3 3.1.21 0.930 0.568 0.545 0.706 14x
htmldate[all] 1.10.0 (fast) 0.924 0.927 0.861 0.925 1x
htmldate[all] 1.10.0 (extensive) 0.908 0.993 0.903 0.949 1.8x
newspaper4k 0.9.5 0.912 0.728 0.680 0.810 2.5x
news-please 1.6.16 0.845 0.777 0.680 0.810 29x

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

License

This package is distributed under the Apache 2.0 license.

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.

JOSS article reference DOI: 10.21105/joss.02439 Zenodo archive DOI: 10.5281/zenodo.3459599

@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,
}

Acknowledgements

Kudos to the following software libraries:

Metadata

Release files for htmldate 1.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for htmldate 1.10.0
File Size Uploaded
htmldate-1.10.0.tar.gz 44.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for htmldate 1.10.0
File Interpreter ABI Platform
htmldate-1.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 76.0 kB

Release files / htmldate-1.10.0.tar.gz

Download URL htmldate-1.10.0.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a38df10772ab5d7dbb11896e3f6a852a8491fb1b0965465bc174e23fc2baae58
BLAKE2b-256 checksum
How to use checksums
ad1fe7cf83e23d7b68105de8b874a8b36ba23b450d6f71388583e4ca3ce475ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / htmldate-1.10.0-py3-none-any.whl

Download URL htmldate-1.10.0-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9211dae35ab94147c8ed9e5fc2c9287a5cf31d2394cb7857e7f5dd814eb2aad6
BLAKE2b-256 checksum
How to use checksums
f717d3356233c826c641f940983d9479eab27faec59d49f4070bc58e80fcc021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

1.10.0 This release

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

2 release files

1.9.1

2 release files

1.9.0

2 release files

1.8.1

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.6

2 release files

0.5.5

2 release files

0.5.3

2 release files

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.1

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page