diff options
| author | Zach DeCook <zachdecook@librem.one> | 2021-02-15 20:36:25 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2021-02-15 20:36:25 -0500 |
| commit | 05990f50746cd0aecb7221af853782cc59427dfc (patch) | |
| tree | 9333b41a827d3c7c7eabe02fcc2e3fb0875f12f1 /zachwalk.py | |
| parent | ccd4b73baab80939c5bef61d738564504e3207a1 (diff) | |
| download | zachwalk-05990f50746cd0aecb7221af853782cc59427dfc.tar.gz | |
Url checking: only check gemini urls
Diffstat (limited to 'zachwalk.py')
| -rwxr-xr-x | zachwalk.py | 12 |
1 files changed, 8 insertions, 4 deletions
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() |
