use dateparser module if available

This behaves better than the feedparser date parser in most scenarios.

Still needs unit tests and dependency checks.

Closes: #6
parent be5e7e27
Pipeline #48221571 (#165) passed with stage
in 2 minutes and 12 seconds
......@@ -53,6 +53,11 @@ import requests_file
import sqlite3
import xdg.BaseDirectory as xdg_base_dirs
import dateparser
except ImportError:
dateparser = False
class FeedManager(object):
"""a feed manager fetches and stores feeds.
......@@ -66,6 +71,10 @@ class FeedManager(object):
self.conf_path = conf_path
self.db_path = db_path
self.conf_storage = FeedConfStorage(self.conf_path, pattern=pattern)
if dateparser:
def dateparser_tuple_parser(string):
return dateparser.parse(string).utctimetuple()
def __repr__(self):
return 'FeedManager(%s, %s, %s)' % (self.conf_path, self.db_path, self.pattern)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment