feeds: disable 'multi' ruleset

RSS ruleset has been cut into 4 rulesets
master
pictuga 2020-03-18 16:20:42 +01:00
parent 186fa2b408
commit 6ce616106b
2 changed files with 59 additions and 82 deletions

View File

@ -1,76 +1,73 @@
[rss]
mode = xpath
[rss-rdf]
mode = xml
;RSS, rdf:rdf
;RSS, channel
;Atom
;Atom 03
timeformat = %a, %d %b %Y %H:%M:%S %Z
timeformat =
%a, %d %b %Y %H:%M:%S %Z
%a, %d %b %Y %H:%M:%S %Z
%Y-%m-%dT%H:%M:%SZ
%Y-%m-%dT%H:%M:%SZ
base = <?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"></rdf:RDF>
base =
<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/"></rdf:RDF>
<?xml version="1.0"?><rss version="2.0"></rss>
<?xml version="1.0"?><feed xmlns="http://www.w3.org/2005/Atom"></feed>
<?xml version="1.0"?><feed version="0.3" xmlns="http://purl.org/atom/ns#"></feed>
title = /rdf:RDF/rssfake:channel/rssfake:title
desc = /rdf:RDF/rssfake:channel/rssfake:description
items = /rdf:RDF/rssfake:channel/rssfake:item
title =
/rdf:RDF/rssfake:channel/rssfake:title
/rss/channel/title
/atom:feed/atom:title
/atom03:feed/atom03:title
item_title = rssfake:title
item_link = rssfake:link
item_desc = rssfake:description
item_content = content:encoded
item_time = rssfake:pubDate
desc =
/rdf:RDF/rssfake:channel/rssfake:description
/rss/channel/description
/atom:feed/atom:subtitle
/atom03:feed/atom03:subtitle
items =
/rdf:RDF/rssfake:channel/rssfake:item
/rss/channel/item
/atom:feed/atom:entry
/atom03:feed/atom03:entry
[rss-channel]
mode = xml
item_title =
rssfake:title
title
atom:title
atom03:title
timeformat = %a, %d %b %Y %H:%M:%S %Z
item_link =
rssfake:link
link
atom:link/@href
atom03:link/@href
base = <?xml version="1.0"?><rss version="2.0"></rss>
item_desc =
rssfake:description
description
atom:summary
atom03:summary
title = /rss/channel/title
desc = /rss/channel/description
items = /rss/channel/item
item_content =
content:encoded
content:encoded
atom:content
atom03:content
item_title = title
item_link = link
item_desc = description
item_content = content:encoded
item_time = pubDate
item_time =
rssfake:pubDate
pubDate
atom:published
atom03:published
item_updated =
; N/A
; N/A
atom:updated
atom03:updated
[rss-atom]
mode = xml
timeformat = %Y-%m-%dT%H:%M:%SZ
base = <?xml version="1.0"?><feed xmlns="http://www.w3.org/2005/Atom"></feed>
title = /atom:feed/atom:title
desc = /atom:feed/atom:subtitle
items = /atom:feed/atom:entry
item_title = atom:title
item_link = atom:link/@href
item_desc = atom:summary
item_content = atom:content
item_time = atom:published
item_updated = atom:updated
[rss-atom03]
mode = xml
timeformat = %Y-%m-%dT%H:%M:%SZ
base = <?xml version="1.0"?><feed version="0.3" xmlns="http://purl.org/atom/ns#"></feed>
title = /atom03:feed/atom03:title
desc = /atom03:feed/atom03:subtitle
items = /atom03:feed/atom03:entry
item_title = atom03:title
item_link = atom03:link/@href
item_desc = atom03:summary
item_content = atom03:content
item_time = atom03:published
item_updated = atom03:updated
[json]
mode = json

View File

@ -67,31 +67,11 @@ class ParserBase(object):
self.rules = rules
if data is None:
if isinstance(self.rules['items'], list):
data = rules['base'][0]
else:
data = rules['base']
data = rules['base']
self.root = self.parse(data)
self.parent = parent
# do `if multi` and select the correct rule for each (and split \n)
if isinstance(self.rules['items'], list):
for (i, rule) in enumerate(self.rules['items']):
if self.rule_search(rule) is not None:
key = i
break
else:
key = 0
len_items = len(rules['items'])
for arg in self.rules.keys():
if (isinstance(self.rules[arg], list)
and len(self.rules[arg]) == len_items):
self.rules[arg] = self.rules[arg][key]
def parse(self, raw):
pass