fix dictionary update of rss feeds without titles
This commit is contained in:
parent
fe21804a63
commit
837a77809c
@ -2,23 +2,24 @@ from feedparser import parse
|
||||
import random
|
||||
|
||||
|
||||
def _parse_single_rss_feed(url):
|
||||
def _parse_single_rss_feed(url, entries):
|
||||
feed = parse(url)
|
||||
entries = {}
|
||||
entrylength = len(entries)
|
||||
for entrynumber, entry in enumerate(feed.entries):
|
||||
if entry.has_key("title"):
|
||||
entries[entry.title] = []
|
||||
entrylist = entries[entry.title]
|
||||
else:
|
||||
title = str(entrynumber)
|
||||
title = str(entrynumber + entrylength)
|
||||
entries[title] = []
|
||||
entrylist = entries[title]
|
||||
entrylist.append(entry.description)
|
||||
|
||||
return entries
|
||||
|
||||
|
||||
def parse_rss_feeds(urls):
|
||||
entries = {}
|
||||
for url in urls:
|
||||
entries.update(_parse_single_rss_feed(url))
|
||||
entries = _parse_single_rss_feed(url, entries)
|
||||
return entries
|
||||
|
@ -18,4 +18,3 @@ for column_from_file in columns_file:
|
||||
column.set_sort_order(column_from_file["sort_order"])
|
||||
|
||||
column.load_content_from_feeds()
|
||||
print(len(column.entries))
|
||||
|
Loading…
Reference in New Issue
Block a user