about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-02-04 23:18:40 -0500
committerZach DeCook <zachdecook@librem.one>2021-02-04 23:18:40 -0500
commitc5d4f0eeba685b4391fed6206dbce035e20f2eaa (patch)
tree3c82a41fd0abbd7509386832e133a6891f608340
downloadzachwalk-c5d4f0eeba685b4391fed6206dbce035e20f2eaa.tar.gz
Zachwalk: parse sites from a gemini file
-rwxr-xr-xzachwalk.py17
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}')