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 a01d3f0..3e7653b 100644
--- a/afeedprocessor/afeedparser.py
+++ b/afeedprocessor/afeedparser.py
@@ -19,7 +19,7 @@ class FeedParser:
19 return [e['term'] for e in lst] 19 return [e['term'] 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 return PyRSS2Gen.RSSItem( 22 rss_item = PyRSS2Gen.RSSItem(
23 title=entry.get('title'), 23 title=entry.get('title'),
24 link=entry.get('link'), 24 link=entry.get('link'),
25 description=entry.get('description'), 25 description=entry.get('description'),
@@ -32,8 +32,11 @@ class FeedParser:
32 source=entry.get('source'), 32 source=entry.get('source'),
33 ) 33 )
34 34
35 rss_item.source_entity = entry
36 return rss_item
37
35 def get_rss2_from_feed(self, feed, entries): 38 def get_rss2_from_feed(self, feed, entries):
36 return PyRSS2Gen.RSS2( 39 rss_feed = PyRSS2Gen.RSS2(
37 title=feed.get('title'), 40 title=feed.get('title'),
38 link=feed.get('link'), 41 link=feed.get('link'),
39 description=feed.get('subtitle'), 42 description=feed.get('subtitle'),
@@ -60,6 +63,9 @@ class FeedParser:
60 items=[self.get_rss_item_for_entry(entry) for entry in entries], 63 items=[self.get_rss_item_for_entry(entry) for entry in entries],
61 ) 64 )
62 65
66 rss_feed.source_entity = feed
67 return rss_feed
68
63 def parse(self, feed): 69 def parse(self, feed):
64 parsed_feed = feedparser.parse(feed) 70 parsed_feed = feedparser.parse(feed)
65 return self.get_rss2_from_feed(parsed_feed.feed, parsed_feed.entries) 71 return self.get_rss2_from_feed(parsed_feed.feed, parsed_feed.entries)