Skip to content

Commit

Permalink
YouTube: Fix pubDate via monkey-patching (bug 1492)
Browse files Browse the repository at this point in the history
This is very dirty, but it works for now, and avoids
the annoying sorting/publishing issues with YouTube.
  • Loading branch information
thp committed Dec 5, 2011
1 parent 07c60f4 commit 876acad
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/gpodder/feedcore.py
Expand Up @@ -61,6 +61,21 @@ def _start_media_content(self, attrsD):
if '*/*' not in feedparser.ACCEPT_HEADER.split(','):
feedparser.ACCEPT_HEADER += ',*/*'

# Fix problem with YouTube feeds and pubDate/atom:modified
# https://bugs.gpodder.org/show_bug.cgi?id=1492
# http://code.google.com/p/feedparser/issues/detail?id=310
def _end_updated(self):
value = self.pop('updated')
parsed_value = feedparser._parse_date(value)
overwrite = ('youtube.com' not in self.baseuri)
self._save('updated_parsed', parsed_value, overwrite=overwrite)

try:
feedparser._FeedParserMixin._end_updated = _end_updated
except:
pass


patch_feedparser()


Expand Down

0 comments on commit 876acad

Please sign in to comment.