aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--afeedprocessor/afeedparser.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/afeedprocessor/afeedparser.py b/afeedprocessor/afeedparser.py
index 3e7653b..3cb2c89 100644
--- a/afeedprocessor/afeedparser.py
+++ b/afeedprocessor/afeedparser.py
@@ -13,10 +13,10 @@ class FeedParser:
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 15 @staticmethod
16 def get_terms(lst): 16 def get_keys(lst, key):
17 if lst is None: 17 if lst is None:
18 return None 18 return None
19 return [e['term'] for e in lst] 19 return [e[key] for e in lst]
20 20
21 def get_rss_item_for_entry(self, entry): 21 def get_rss_item_for_entry(self, entry):
22 rss_item = PyRSS2Gen.RSSItem( 22 rss_item = PyRSS2Gen.RSSItem(
@@ -24,7 +24,7 @@ class FeedParser:
24 link=entry.get('link'), 24 link=entry.get('link'),
25 description=entry.get('description'), 25 description=entry.get('description'),
26 author=entry.get('author'), 26 author=entry.get('author'),
27 categories=self.get_terms(entry.get('tags')), 27 categories=self.get_keys(entry.get('tags'), 'term'),
28 comments=entry.get('comments'), 28 comments=entry.get('comments'),
29 enclosure=self.get_first(entry.get('enclosures')), 29 enclosure=self.get_first(entry.get('enclosures')),
30 guid=entry.get('id'), 30 guid=entry.get('id'),
@@ -43,12 +43,12 @@ class FeedParser:
43 43
44 language=feed.get('language'), 44 language=feed.get('language'),
45 copyright=feed.get('rights'), 45 copyright=feed.get('rights'),
46 managingEditor=feed.get('contributors'), 46 managingEditor=self.get_first(self.get_keys(feed.get('contributors'), 'name')),
47 webMaster=feed.get('publisher'), 47 webMaster=feed.get('publisher'),
48 pubDate=self.date_tuple_to_datetime(feed.get('published_parsed')), 48 pubDate=self.date_tuple_to_datetime(feed.get('published_parsed')),
49 lastBuildDate=self.date_tuple_to_datetime(feed.get('updated_parsed')), 49 lastBuildDate=self.date_tuple_to_datetime(feed.get('updated_parsed')),
50 50
51 categories=self.get_terms(feed.get('tags')), 51 categories=self.get_keys(feed.get('tags'), 'term'),
52 generator=feed.get('generator'), 52 generator=feed.get('generator'),
53 docs=feed.get('docs'), 53 docs=feed.get('docs'),
54 cloud=feed.get('cloud'), 54 cloud=feed.get('cloud'),