Mark RSS Bridge feeds
This commit is contained in:
parent
1844b5b055
commit
524c9e5148
|
@ -41,6 +41,7 @@ with open(sys.argv[1]) as file, open(sys.argv[2], 'w+') as out:
|
||||||
print(text)
|
print(text)
|
||||||
out.write(text)
|
out.write(text)
|
||||||
continue
|
continue
|
||||||
|
rss_bridge = urlparse(feedurl).hostname.startswith('rss.')
|
||||||
try:
|
try:
|
||||||
with urlopen(Request(feedurl, headers={'User-Agent': "stop being so fucking obsessed that i'm using urllib ffs"}), timeout=60) as resp:
|
with urlopen(Request(feedurl, headers={'User-Agent': "stop being so fucking obsessed that i'm using urllib ffs"}), timeout=60) as resp:
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
|
@ -68,7 +69,11 @@ with open(sys.argv[1]) as file, open(sys.argv[2], 'w+') as out:
|
||||||
url = input().strip() or url
|
url = input().strip() or url
|
||||||
else:
|
else:
|
||||||
url = url.text or url.attrib['href']
|
url = url.text or url.attrib['href']
|
||||||
text = f'<li><b><a href="{html.escape(urljoin(feedurl, url))}">{html.escape(find_ignore_ns(channel, "title").text)}</a> (<a href="{html.escape(feedurl)}">feed</a>)'
|
text = f'<li><b><a href="{html.escape(urljoin(feedurl, url))}">{html.escape(find_ignore_ns(channel, "title").text)}</a> (<a href="{html.escape(feedurl)}">'
|
||||||
|
if rss_bridge:
|
||||||
|
text += 'auto-generated '
|
||||||
|
text += 'feed</a>)'
|
||||||
|
if not rss_bridge:
|
||||||
desc = find_ignore_ns(channel, 'description')
|
desc = find_ignore_ns(channel, 'description')
|
||||||
if desc is not None and desc.text:
|
if desc is not None and desc.text:
|
||||||
if desc := desc.text.strip():
|
if desc := desc.text.strip():
|
||||||
|
|
Loading…
Reference in New Issue