Feed date scraper for Gemini (protocol)
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)