From 603bd06729a7fec937ed679bc60654457a823f30 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Tue, 11 Aug 2015 15:57:51 +0200 Subject: Save parsed source entity --- afeedprocessor/afeedparser.py | 10 ++++++++-- 1 file 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: return [e['term'] for e in lst] def get_rss_item_for_entry(self, entry): - return PyRSS2Gen.RSSItem( + rss_item = PyRSS2Gen.RSSItem( title=entry.get('title'), link=entry.get('link'), description=entry.get('description'), @@ -32,8 +32,11 @@ class FeedParser: source=entry.get('source'), ) + rss_item.source_entity = entry + return rss_item + def get_rss2_from_feed(self, feed, entries): - return PyRSS2Gen.RSS2( + rss_feed = PyRSS2Gen.RSS2( title=feed.get('title'), link=feed.get('link'), description=feed.get('subtitle'), @@ -60,6 +63,9 @@ class FeedParser: items=[self.get_rss_item_for_entry(entry) for entry in entries], ) + rss_feed.source_entity = feed + return rss_feed + def parse(self, feed): parsed_feed = feedparser.parse(feed) return self.get_rss2_from_feed(parsed_feed.feed, parsed_feed.entries) -- cgit v1.2.3