mirror of https://gitlab.com/bashrc2/epicyon
Simplify
parent
1f81dbb947
commit
3fabb8e2f6
16
newswire.py
16
newswire.py
|
@ -471,7 +471,6 @@ def xml_podcast_to_dict(xml_str: str) -> {}:
|
||||||
def _get_link_from_rss_item(rss_item: str) -> str:
|
def _get_link_from_rss_item(rss_item: str) -> str:
|
||||||
"""Extracts rss link from rss item string
|
"""Extracts rss link from rss item string
|
||||||
"""
|
"""
|
||||||
link = None
|
|
||||||
if '<enclosure ' in rss_item:
|
if '<enclosure ' in rss_item:
|
||||||
# get link from audio or video enclosure
|
# get link from audio or video enclosure
|
||||||
enclosure = rss_item.split('<enclosure ')[1]
|
enclosure = rss_item.split('<enclosure ')[1]
|
||||||
|
@ -481,15 +480,14 @@ def _get_link_from_rss_item(rss_item: str) -> str:
|
||||||
('"audio/' in enclosure or '"video/' in enclosure):
|
('"audio/' in enclosure or '"video/' in enclosure):
|
||||||
link_str = enclosure.split('url="')[1]
|
link_str = enclosure.split('url="')[1]
|
||||||
if '"' in link_str:
|
if '"' in link_str:
|
||||||
link_str = link_str.split('"')[0]
|
link = link_str.split('"')[0]
|
||||||
if '://' in link_str:
|
if '://' in link:
|
||||||
link = link_str
|
return link
|
||||||
|
|
||||||
if not link:
|
link = rss_item.split('<link>')[1]
|
||||||
link = rss_item.split('<link>')[1]
|
link = link.split('</link>')[0]
|
||||||
link = link.split('</link>')[0]
|
if '://' not in link:
|
||||||
if '://' not in link:
|
return None
|
||||||
return None
|
|
||||||
return link
|
return link
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue