Skip to main content

qddate — quick and dirty date parsing for scraped HTML

CI PyPI Version Docs Coverage Gitter

qddate is a Python 3 library focused on parsing date strings extracted from messy HTML pages as fast as possible. It was born out of long-term news aggregation work and is intentionally pragmatic: fewer abstractions, lots of hard-coded optimizations, and enough language coverage to process millions of strings at scale. The parser ships as part of the "news reconstruction" toolchain that can build RSS feeds for sites that never offered one.

If you need broader language coverage (but can trade speed for flexibility), check out dateparser or dateutil.

Documentation

Full documentation is automatically published at Read the Docs.

Features

  • 712+ date patterns (expanded from 89 base patterns) and growing on demand
  • Multi-language parsing (English, Russian, Spanish, Portuguese, and more)
  • Handles left-aligned dates with trailing text: 12.03.1999 some text here
  • Prioritizes speed via pyparsing, hard-coded constants, and dirty tricks

Recent updates

1.0.10 — English weekday with abbreviated month-first dates, e.g. Thursday, Jun 25, 2026 and Monday, Jun 22, 2026 - 13:46.

1.0.9 — Spanish article dates with a comma before the year, e.g. 03 de Julio, 2026 and 30 de junio, 2026 (common on Latin American government sites).

See CHANGELOG.md for the full release history.

Limitations

  • Limited language coverage compared to larger projects
  • Adding new languages requires editing pattern tables manually
  • Rare/odd formats may still slip through
  • No relative date parsing or calendar support

Speed Optimization

  • All constants are embedded directly; no runtime configuration files
  • Only depends on datetime and pyparsing (plus packaging tooling)
  • Avoids regular expressions in favor of pre-generated pyparsing patterns
  • Aggressive pattern filtering using min/max length filters and prefix heuristics
  • Nothing is loaded from disk at runtime besides the Python modules themselves

Benchmark & Performance Notes

  • Standard benchmarks: benchmarks/bench.py compares qddate with dateparser on the bundled corpus. Run python benchmarks/bench.py to execute.
  • Webpage data benchmarks: benchmarks/benchmark_webpage_data.py tests qddate against other libraries using real-world text snippets extracted from webpages. Use scripts/generate_webpage_test_data.py to generate test data from government and international organization websites.
  • Comprehensive performance tests: benchmarks/comprehensive_performance_test.py provides extensive performance testing with detailed metrics, pattern analysis, and regression detection. See benchmarks/README_PERFORMANCE_TEST.md for details.
  • PERFORMANCE_ANALYSIS.md documents the 2025 profiling work (length-based indexing, prefix caching, packrat parsing, etc.) and how to evaluate future optimizations.
  • Benchmark numbers depend on hardware, Python version, and workload. Please share your results in issues if you run the benchmark elsewhere.

Usage

The simplest way to work with qddate is through qddate.DateParser and its parse method:

import qddate

parser = qddate.DateParser()
print(parser.parse('2012-12-15'))
print(parser.parse('Fri, 12 Dec 2014 10:55:50'))
print(parser.parse('Thursday, Jun 25, 2026'))
print(parser.parse('03 de Julio, 2026'))
print(parser.parse('пятница, июля 17, 2015'))

The parser auto-detects languages for each string and returns datetime.datetime instances when it finds a match.

Dependencies

Supported Languages

  • Bulgarian
  • Czech
  • English
  • French
  • German
  • Italian
  • Polish
  • Portuguese
  • Russian
  • Spanish
  • Turkish

Thanks

The original parser dates back to 2008 and evolved from regular expressions into pyparsing over time. Thanks to the ScrapingHub team for the inspiration to clean up the code, documentation, and build tooling, and for motivating the public release.

Metadata

Release files for qddate 1.0.10

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

Source distribution (sdist)

Source distribution for qddate 1.0.10
File Size Uploaded
qddate-1.0.10.tar.gz 95.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qddate 1.0.10
File Interpreter ABI Platform
qddate-1.0.10-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 214.3 kB

Release files / qddate-1.0.10.tar.gz

Download URL qddate-1.0.10.tar.gz
Size 95.5 kB
Tags Source
SHA-256 checksum
How to use checksums
784208e5b0aaa50ef37a3232f881106579e1f4c5a5c68c70bc1b74a5f1f93186
BLAKE2b-256 checksum
How to use checksums
b74c8e41dfec5966438748a3ad48821693c8a13b5e3356be360f90533fe7b5be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / qddate-1.0.10-py2.py3-none-any.whl

Download URL qddate-1.0.10-py2.py3-none-any.whl
Size 118.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2e2056f5e81a47af0fb65686c10f4c567043ee9fd50e7bcf34baa561273d27b8
BLAKE2b-256 checksum
How to use checksums
b1c19c2e0952b040209dc540fde3439547e3058c2f610de709879649ce10e654
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.10 This release

2 release files

1.0.8

2 release files

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

0.1.1

2 release files

0.1.0

3 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