mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
News download: Handle more types of invalid timestamps in RSS feeds
This commit is contained in:
parent
6ccbaac207
commit
a553db9626
@ -191,6 +191,14 @@ class Feed:
|
||||
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…
x
Reference in New Issue
Block a user