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)
 | 
			
		||||
                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,7 +69,11 @@ 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'<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')
 | 
			
		||||
                if desc is not None and desc.text:
 | 
			
		||||
                    if desc := desc.text.strip():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue