Add support for konbata

This commit is contained in:
blank X 2021-08-09 21:29:37 +07:00
parent 2b9468a545
commit 485fca9132
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 5 additions and 0 deletions

View File

@ -36,6 +36,11 @@ with open(sys.argv[1]) as file, open(sys.argv[2], 'w+') as out:
inp = shlex.split(i, comments=True) inp = shlex.split(i, comments=True)
if 'blog' in inp[1:]: if 'blog' in inp[1:]:
feedurl = inp[0] feedurl = inp[0]
if feedurl.startswith('exec:~/.local/bin/konbata '):
text = f'<li><b><a href="{html.escape(feedurl[26:])}">{html.escape(inp[-1][1:])}</a> (<a href="{html.escape(feedurl[26:])}">feed</a>)</b></li>'
print(text)
out.write(text)
continue
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: