manage feeds with missing id. fixes #13

This commit is contained in:
Carl Chenet 2017-05-05 18:59:50 +02:00
parent 2ca649d22e
commit 8b294a4b5b

View file

@ -99,20 +99,35 @@ class Main(object):
# cache the ids of last rss feeds # cache the ids of last rss feeds
if not clioptions.all: if not clioptions.all:
for i in entries: for i in entries:
if 'id' in i and i['id'] not in cache.getdeque(): if 'id' in i:
totweet.append(i) if i['id'] not in cache.getdeque():
totweet.append(i)
elif 'guid' in i:
if i['guid'] not in cache.getdeque():
totweet.append(i)
else:
# if id or guid not in the entry, use link
if i['link'] not in cache.getdeque():
totweet.append(i)
else: else:
totweet = entries totweet = entries
for entry in totweet: for entry in totweet:
if 'id' not in entry: if 'id' in entry:
# malformed feed entry, skip logging.debug('found feed entry {entryid}'.format(entryid=entry['id']))
continue rss = {
logging.debug('found feed entry {entryid}'.format(entryid=entry['id'])) 'id': entry['id'],
}
rss = { elif 'guid' in entry:
'id': entry['id'], logging.debug('found feed entry {entryid}'.format(entryid=entry['guid']))
} rss = {
'id': entry['guid'],
}
else:
logging.debug('found feed entry {entryid}'.format(entryid=entry['link']))
rss = {
'id': entry['link'],
}
severalwordsinhashtag = False severalwordsinhashtag = False
# lets see if the rss feed has hashtag # lets see if the rss feed has hashtag