aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--afeedprocessor/afeedparser.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/afeedprocessor/afeedparser.py b/afeedprocessor/afeedparser.py
index 0c23187..a01d3f0 100644
--- a/afeedprocessor/afeedparser.py
+++ b/afeedprocessor/afeedparser.py
@@ -12,13 +12,19 @@ class FeedParser:
12 def get_first(lst): 12 def get_first(lst):
13 return lst[0] if lst and len(lst) > 0 else None 13 return lst[0] if lst and len(lst) > 0 else None
14 14
15 @staticmethod
16 def get_terms(lst):
17 if lst is None:
18 return None
19 return [e['term'] for e in lst]
20
15 def get_rss_item_for_entry(self, entry): 21 def get_rss_item_for_entry(self, entry):
16 return PyRSS2Gen.RSSItem( 22 return PyRSS2Gen.RSSItem(
17 title=entry.get('title'), 23 title=entry.get('title'),
18 link=entry.get('link'), 24 link=entry.get('link'),
19 description=entry.get('description'), 25 description=entry.get('description'),
20 author=entry.get('author'), 26 author=entry.get('author'),
21 categories=entry.get('tags'), 27 categories=self.get_terms(entry.get('tags')),
22 comments=entry.get('comments'), 28 comments=entry.get('comments'),
23 enclosure=self.get_first(entry.get('enclosures')), 29 enclosure=self.get_first(entry.get('enclosures')),
24 guid=entry.get('id'), 30 guid=entry.get('id'),
@@ -39,7 +45,7 @@ class FeedParser:
39 pubDate=self.date_tuple_to_datetime(feed.get('published_parsed')), 45 pubDate=self.date_tuple_to_datetime(feed.get('published_parsed')),
40 lastBuildDate=self.date_tuple_to_datetime(feed.get('updated_parsed')), 46 lastBuildDate=self.date_tuple_to_datetime(feed.get('updated_parsed')),
41 47
42 categories=feed.get('tags'), 48 categories=self.get_terms(feed.get('tags')),
43 generator=feed.get('generator'), 49 generator=feed.get('generator'),
44 docs=feed.get('docs'), 50 docs=feed.get('docs'),
45 cloud=feed.get('cloud'), 51 cloud=feed.get('cloud'),