Feed date scraper for Gemini (protocol)
zachwalk: also read from stdin
| -rwxr-xr-x | zachwalk.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/zachwalk.py b/zachwalk.py index a7d1a8d..aee0458 100755 --- a/zachwalk.py +++ b/zachwalk.py @@ -4,6 +4,7 @@ import sys import socket import ssl +import fileinput from dateutil.parser import parse DEFAULT = '1970-01-01' @@ -40,9 +41,8 @@ def gnd(fp): pass return DEFAULT -def main(argv): - with open(argv[1]) as f: - for line in f: +def main(): + for line in fileinput.input(): #stdin or file from argv if line[0:2] == '=>': # plz don't use multiple spaces. url = line.split(' ')[1] @@ -54,4 +54,4 @@ def getdesc(line): return ' '.join(line.split(' ')[2:]) if __name__ == '__main__': - main(sys.argv) + main() |