diff --git a/genbloglist.py b/genbloglist.py index d5bdf17..10c6f6e 100644 --- a/genbloglist.py +++ b/genbloglist.py @@ -41,6 +41,7 @@ with open(sys.argv[1]) as file, open(sys.argv[2], 'w+') as out: print(text) out.write(text) continue + rss_bridge = urlparse(feedurl).hostname.startswith('rss.') try: 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: @@ -68,22 +69,26 @@ with open(sys.argv[1]) as file, open(sys.argv[2], 'w+') as out: url = input().strip() or url else: url = url.text or url.attrib['href'] - text = f'
  • {html.escape(find_ignore_ns(channel, "title").text)} (feed)' - desc = find_ignore_ns(channel, 'description') - if desc is not None and desc.text: - if desc := desc.text.strip(): - text += f': {html.escape(desc)}' - else: - text += '' - else: - desc = find_ignore_ns(channel, 'subtitle') + text = f'
  • {html.escape(find_ignore_ns(channel, "title").text)} (' + if rss_bridge: + text += 'auto-generated ' + text += 'feed)' + if not rss_bridge: + desc = find_ignore_ns(channel, 'description') if desc is not None and desc.text: if desc := desc.text.strip(): text += f': {html.escape(desc)}' else: text += '' else: - text += '' + desc = find_ignore_ns(channel, 'subtitle') + if desc is not None and desc.text: + if desc := desc.text.strip(): + text += f': {html.escape(desc)}' + else: + text += '' + else: + text += '' print(text, '
  • ', sep='') out.write(text) out.write('\n')