Feed date scraper for Gemini (protocol)
Zachwalk: parse sites from a gemini file
| -rwxr-xr-x | zachwalk.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/zachwalk.py b/zachwalk.py new file mode 100755 index 0000000..cd3e9f3 --- /dev/null +++ b/zachwalk.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python3 +"""load links from a gemini file and output the latest date for each one""" + +import sys + +def getnewestdate(url): + """load the url, and find the newest date listed in a link""" + return '1970-01-01' + +with open(sys.argv[1]) as f: + for line in f: + if line[0:2] == '=>': + # plz don't use multiple spaces. + url = line.split(' ')[1] + desc = line[3+len(url):].strip() + newestdate = getnewestdate(url) + print(f'=> {url} {newestdate} - {desc}') |