summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-11-05 14:07:54 -0800
committerBen Sima <ben@bsima.me>2018-11-05 14:07:54 -0800
commit1ec7b6c43bc264798adec51efcfed7060c9d9c83 (patch)
tree193bffb7121bc4a8d42d120e4e6cf71d0d193b3d
parent099544381c4f703dc4ec7fb6e785bb262ee02276 (diff)
Fix python scripts to work with nix
-rwxr-xr-xrdr3
-rwxr-xr-xtextract6
2 files changed, 6 insertions, 3 deletions
diff --git a/rdr b/rdr
index d08ceaa..a258698 100755
--- a/rdr
+++ b/rdr
@@ -1,4 +1,5 @@
-#!/usr/bin/env sh
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p pandoc
textract "$1" \
| pandoc -f html -t markdown \
diff --git a/textract b/textract
index 996393f..f80be36 100755
--- a/textract
+++ b/textract
@@ -1,4 +1,5 @@
-#!/usr/bin/env python3.5
+#! /usr/bin/env nix-shell
+#! nix-shell -i python -p "python3.withPackages(p: [p.requests p.pyreadability])"
import argparse
from readability import Document
@@ -9,11 +10,12 @@ cli = argparse.ArgumentParser('read a url')
cli.add_argument('url', type=str)
if __name__ == '__main__':
+ args = cli.parse_args()
try:
- args = cli.parse_args()
resp = requests.get(args.url)
doc = Document(resp.text)
sys.stdout.write(doc.summary())
sys.exit(0)
except:
+ print("Could not fetch document.")
sys.exit(1)