def getwordcounts(url):
# Parse the feed
d = feedparser.parse(url)
wc = {}
# Loop over all the entries
for e in d.entries:
if 'summary' in e:
summary = e.summary
else:
summary = e.description
# Extract a list of words
words = getwords(e.title + ' ' + summary)
for word in words:
wc.setdefault(word, 0)
wc[word] += 1
return d.feed.title, wc
评论列表
文章目录