From 05990f50746cd0aecb7221af853782cc59427dfc Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Mon, 15 Feb 2021 20:36:25 -0500 Subject: Url checking: only check gemini urls --- zachwalk.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'zachwalk.py') diff --git a/zachwalk.py b/zachwalk.py index b45d333..a270850 100755 --- a/zachwalk.py +++ b/zachwalk.py @@ -55,15 +55,19 @@ def replaceDateIfNewer(desc, newestdate): def main(): for line in fileinput.input(): #stdin or file from argv if line[0:2] == '=>': - # plz don't use multiple spaces. - url = line.split(' ')[1] + # plz don't use multiple spaces. + url = line.split(' ')[1] + if isAbsGeminiUrl(url): desc = getdesc(line) olddate = gnd(url) newestdate = getnewestdate(url) desc = replaceDateIfNewer(desc, newestdate) print(f'=> {url} {desc}') - else: - print(line.rstrip()) + continue + print(line.rstrip()) + +def isAbsGeminiUrl(url): + return url[0:9] == 'gemini://' def getdesc(line): return ' '.join(line.split(' ')[2:]).strip() -- cgit 1.4.1