about summary refs log tree commit diff
path: root/zachwalk.py
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-02-07 22:57:16 -0500
committerZach DeCook <zachdecook@librem.one>2021-02-07 22:57:16 -0500
commit2bf26df28f31e4279ee3339b12858f302f2c6aa5 (patch)
tree812da9f807d80614a4fda7d00c320bd67e881ce3 /zachwalk.py
parent5a0ebe1c44afdd4782d33ba075b22c4ebb0281e2 (diff)
downloadzachwalk-2bf26df28f31e4279ee3339b12858f302f2c6aa5.tar.gz
date parsing: only attempt to check link description
Diffstat (limited to 'zachwalk.py')
-rwxr-xr-xzachwalk.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/zachwalk.py b/zachwalk.py
index 7965962..7c8680e 100755
--- a/zachwalk.py
+++ b/zachwalk.py
@@ -29,7 +29,7 @@ def gnd(fp):
      line=line.decode('UTF-8')
      if line.strip()[0:2] == '=>':
       try:
-        date = parse(line,fuzzy=True).date()
+        date = parse(getdesc(line),fuzzy=True).date()
         # todo: read lots of these and compare them
         return date
       except:
@@ -42,9 +42,12 @@ def main(argv):
         if line[0:2] == '=>':
             # plz don't use multiple spaces.
             url = line.split(' ')[1]
-            desc = line[3+len(url):].strip()
+            desc = getdesc(line)
             newestdate = getnewestdate(url)
             print(f'=> {url} {newestdate} - {desc}')
 
+def getdesc(line):
+  return ' '.join(line.split(' ')[2:])
+
 if __name__ == '__main__':
   main(sys.argv)