adapted to feedparser 5.1.3

This commit is contained in:
Ronald Schaten 2013-03-19 22:40:47 +01:00
parent 3333d1fcaf
commit f6e57378f2
2 changed files with 2456 additions and 1298 deletions

View File

@ -84,7 +84,7 @@ class Feedinfo(Base):
self.encoding = parser.get('encoding') self.encoding = parser.get('encoding')
self.bozo = parser.get('bozo') self.bozo = parser.get('bozo')
self.lastfetched = datetime.now() self.lastfetched = datetime.now()
if parser.get('status') == 200: if parser.get('status') == 200 or parser.get('status') == 302:
self.lastsuccessful = datetime.now() self.lastsuccessful = datetime.now()
@ -122,15 +122,18 @@ class Entry(Base):
self.link = entry.get('link').encode('latin-1', 'replace') self.link = entry.get('link').encode('latin-1', 'replace')
if entry.has_key('summary'): if entry.has_key('summary'):
self.summary = entry.get('summary').encode('latin-1', 'replace') self.summary = entry.get('summary').encode('latin-1', 'replace')
#if entry.has_key('content'): if entry.has_key('content'):
# self.content = entry.get('content') self.content = entry.get('content')[0].value.encode('latin-1', 'replace')
if entry.has_key('author'): if entry.has_key('author'):
self.author = entry.get('author').encode('latin-1', 'replace') self.author = entry.get('author').encode('latin-1', 'replace')
if entry.has_key('updated_parsed'): if entry.has_key('updated_parsed'):
updated_parsed = entry.get('updated_parsed') updated_parsed = entry.get('updated_parsed')
self.updated = datetime.fromtimestamp(mktime(updated_parsed)) self.updated = datetime.fromtimestamp(mktime(updated_parsed))
if entry.has_key('enclosures'): if entry.has_key('enclosures') and len(entry.get('enclosures')) > 0:
self.enclosures = entry.get('enclosures').encode('latin-1', 'replace') print 'enclosures';
pp=pprint.PrettyPrinter(depth=4)
pp.pprint(entry.get('enclosures'))
#self.enclosures = entry.get('enclosures').encode('latin-1', 'replace')
self.lastfetched = datetime.now() self.lastfetched = datetime.now()

File diff suppressed because it is too large Load Diff