mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:04:39 +02:00
News download: Handle more types of invalid timestamps in RSS feeds
This commit is contained in:
parent
6ccbaac207
commit
a553db9626
1 changed files with 8 additions and 0 deletions
|
|
@ -191,6 +191,14 @@ def parse_article(self, item):
|
|||
published = item.get(date_field, None)
|
||||
if published is not None:
|
||||
break
|
||||
if not published:
|
||||
from dateutil.parser import parse
|
||||
for date_field in ('date', 'published', 'updated'):
|
||||
try:
|
||||
published = parse(item[date_field]).timetuple()
|
||||
except Exception:
|
||||
continue
|
||||
break
|
||||
if not published:
|
||||
published = time.gmtime()
|
||||
self.added_articles.append(id)
|
||||
|
|
|
|||
Loading…
Reference in a new issue