From f8ee7e4da51a33bb9fe483fc45b2b8b032d87081 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 13 Jan 2022 22:26:01 +0000 Subject: [PATCH] Different rss link style --- newswire.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/newswire.py b/newswire.py index 394f97ab4..356f5912d 100644 --- a/newswire.py +++ b/newswire.py @@ -567,10 +567,20 @@ def get_link_from_rss_item(rss_item: str) -> (str, str): if '://' in link: return link, mime_type - link = rss_item.split('')[1] - link = link.split('')[0] - if '://' not in link: - return None, None + if '' in rss_item and '' in rss_item: + link = rss_item.split('')[1] + link = link.split('')[0] + if '://' not in link: + return None, None + elif '' in link_str: + link_str = link_str.split('>')[0] + if 'href="' in link_str: + link_str = link_str.split('href="')[1] + if '"' in link_str: + link = link_str.split('"')[0] + return link, mime_type @@ -609,9 +619,7 @@ def _xml2str_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in rss_item: continue - if '' not in rss_item: - continue - if '' not in rss_item: + if '' not in rss_item: continue @@ -708,9 +716,7 @@ def _xml1str_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in rss_item: continue - if '' not in rss_item: - continue - if '' not in rss_item: + if '' not in rss_item: continue @@ -793,9 +799,7 @@ def _atom_feed_to_dict(base_dir: str, domain: str, xml_str: str, continue if '' not in atom_item: continue - if '' not in atom_item: - continue - if '' not in atom_item: + if '' not in atom_item: continue