diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-13 10:59:08 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-02-13 10:59:08 +0100 |
commit | 646640da5cec286ed59a99af8039f5f5feabec47 (patch) | |
tree | 4c9377e5f2f532e815fa1745c3958c1965764c1d /src/web/lib | |
parent | The OPML generation now includes the category of the feeds. (diff) | |
download | newspipe-646640da5cec286ed59a99af8039f5f5feabec47.tar.gz newspipe-646640da5cec286ed59a99af8039f5f5feabec47.tar.bz2 newspipe-646640da5cec286ed59a99af8039f5f5feabec47.zip |
The date of modification of articles is now used to detect changes.
Diffstat (limited to 'src/web/lib')
-rw-r--r-- | src/web/lib/article_utils.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/web/lib/article_utils.py b/src/web/lib/article_utils.py index 328c27ab..176f6a98 100644 --- a/src/web/lib/article_utils.py +++ b/src/web/lib/article_utils.py @@ -37,7 +37,7 @@ def construct_article(entry, feed): feed = feed.dump() "Safe method to transorm a feedparser entry into an article" now = datetime.now() - date = None + date, updated_date = None, None for date_key in ('published', 'updated'): if entry.get(date_key): try: @@ -46,6 +46,10 @@ def construct_article(entry, feed): pass else: break + try: + updated_date = dateutil.parser.parse(entry['updated']) + except Exception: + pass content = get_article_content(entry) article_link = entry.get('link') @@ -67,7 +71,8 @@ def construct_article(entry, feed): 'readed': False, 'like': False, 'content': content, 'retrieved_date': now.isoformat(), - 'date': (date or now).isoformat()} + 'date': (date or now).isoformat(), + 'updated_date': (updated_date or date or now).isoformat()} def get_article_content(entry): content = '' |