Skip to main content

Quick and dirty date parsing Python library to parse HTML dates really fast

Project description

travis build status pypi version Documentation Status Code Coverage Join the chat at https://gitter.im/ivbeg/qddate

qddate is a Python 3 lib that helps to parse any date strings from html pages extremely fast. This lib was created during long term news aggregation efforts and analyzing in wild HTML pages with dates. It’s not intended to have beautiful code, support for so much languages as possible and so on. It should help to process millons of strings to identify and parse dates. qddata was part of proprietary technology of “news reconstruction”. It’s used to automatically create RSS feeds from sites without it.

If you are looking for more advanced (and slower) date parsing try dateparser and dateutil.

Documentation

Documentation is built automatically and can be found on Read the Docs.

Features

  • More than 348 date patterns supported (by the end 2017)

  • Generic parsing of dates in English, Russian, Spanish, Portugenese and other languages

  • Supports strings with with left aligned dates and supplimental words. Example: “12.03.1999 some text here”

  • Extremely fast, uses pyparsing, hard-coded constants and dirty speed optimizations tricks

Limitations

  • Not all languages supported, more languages will be added by request and example

  • Not so easy to add new language based date patterns as it’s in dateparser for example.

  • Could miss some rarely used date formats

  • Doesn’t support relative dates

  • Doesn’t support calendars

Speed optimization

  • All constants are hard encoded, no external settings

  • Uses only datetime and pyparsing as external libraries. No more dependencies, all reused code incorporated into the lib code

  • No regular expressions, instead pre-generated pyparsing patterns

  • Intensive pattern filtering using min/max text length filters and common text patterns

  • No one settings/data file loaded from disk

Usage

The easiest way is to use the qddate.DateParser class, and it’s parse function.

Dependencies

qddate relies on following libraries in some ways:

  • pyparsing is a module for advanced text processing.

Supported languages

  • Bulgarian

  • Czech

  • English

  • French

  • German

  • Portuguese

  • Russian

  • Spanish

Thanks

I wrote this date parsing code at 2008 year and later only updated it several times, migrating from regular expressions to pyparsing. Looking at dateparser <https://github.com/scrapinghub/dateparser> clean code and documentation motivated me to return to this code and to clean it up and to share it publicly. I’ve used same documentation and code style approach and reused build scripts and documentation generation style from dateutil. Many thanks to ScrapingHub team!

Join the chat at https://gitter.im/qddate/Lobby

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qddate-1.0.4.tar.gz (16.2 kB view details)

Uploaded Source

File details

Details for the file qddate-1.0.4.tar.gz.

File metadata

  • Download URL: qddate-1.0.4.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0

File hashes

Hashes for qddate-1.0.4.tar.gz
Algorithm Hash digest
SHA256 181ce417e32e677d0848ce3de7989c6d01aa8b6aa82b04df42d993827f073093
MD5 a92a191406983177325d9b5c6a35880f
BLAKE2b-256 0b11ac1f233f90dc069274f31a3293d4a4b277bbe7392068d45df9bd474a7f81

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page