From c5d4f0eeba685b4391fed6206dbce035e20f2eaa Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Thu, 4 Feb 2021 23:18:40 -0500 Subject: Zachwalk: parse sites from a gemini file --- zachwalk.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 zachwalk.py (limited to 'zachwalk.py') 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}') -- cgit 1.4.1