Browse Source

adding a fallback for when feed URLs do not work

master
manetta 3 years ago
parent
commit
bfc4f02735
  1. 6
      feedtools.py

6
feedtools.py

@ -15,11 +15,15 @@ def update():
for x, feed in enumerate(feeds): for x, feed in enumerate(feeds):
parsed = feedparser.parse(feed) parsed = feedparser.parse(feed)
# print(parsed) if parsed:
# print(f'Adding: { parsed.feed.title } ({ parsed.feed.link })')
x = str(x) x = str(x)
tmp['feeds'][x] = {} tmp['feeds'][x] = {}
if parsed.feed.title:
tmp['feeds'][x]['title'] = parsed.feed.title tmp['feeds'][x]['title'] = parsed.feed.title
else:
tmp['feeds'][x]['title'] = ""
tmp['feeds'][x]['link'] = parsed.feed.link tmp['feeds'][x]['link'] = parsed.feed.link
tmp['feeds'][x]['rss'] = parsed.entries[0].title_detail.base tmp['feeds'][x]['rss'] = parsed.entries[0].title_detail.base
tmp['feeds'][x]['description'] = parsed.feed.description tmp['feeds'][x]['description'] = parsed.feed.description

Loading…
Cancel
Save