From 35b702fffd54cc3623f5ff081138b29d4215e412 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 4 Apr 2020 19:39:32 +0200 Subject: [PATCH] morss: default values for feed creation --- morss/morss.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index 8526320..e3494aa 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -349,14 +349,17 @@ def FeedFetch(url, options): # using custom rules rss = feeds.FeedHTML(xml) + rss.rules['title'] = options.title if options.title else '//head/title' + rss.rules['desc'] = options.desc if options.desc else '//head/meta[@name="description"]/@content' + rss.rules['items'] = options.items - if options.item_title: - rss.rules['item_title'] = options.item_title - if options.item_link: - rss.rules['item_link'] = options.item_link + rss.rules['item_title'] = options.item_title if options.item_title else './/a|.' + rss.rules['item_link'] = options.item_link if options.item_link else './@href|.//a/@href' + if options.item_content: rss.rules['item_content'] = options.item_content + if options.item_time: rss.rules['item_time'] = options.item_time