summaryrefslogtreecommitdiffstats
path: root/util/bin/wiki.firstpar
diff options
context:
space:
mode:
Diffstat (limited to 'util/bin/wiki.firstpar')
-rwxr-xr-xutil/bin/wiki.firstpar23
1 files changed, 23 insertions, 0 deletions
diff --git a/util/bin/wiki.firstpar b/util/bin/wiki.firstpar
new file mode 100755
index 00000000..d2181f1b
--- /dev/null
+++ b/util/bin/wiki.firstpar
@@ -0,0 +1,23 @@
+#! /bin/bash
+set -euf
+
+A=Mozilla
+
+pwd="$(dirname "$(readlink -f "$0")")"
+
+for x in \
+ "$pwd/../../submodules/github/tmpvar" \
+ "$pwd/../../submodules/github/mikeal" \
+ "$pwd/../../submodules/github/NV" \
+ "$pwd/../../submodules/github/tautologistics" \
+; do
+ export NODE_PATH="`readlink -f "$x"`${NODE_PATH+:$NODE_PATH}"
+done
+
+# ensure query is ready
+(cd "$pwd/../.." && git submodule update --init)
+
+query() {
+ node "$(readlink -f "$pwd/../../submodules/github/visionmedia/query")" "$@"
+}
+curl -b redirect=seen -L -e http://de.wikipedia.org/wiki/$RANDOM -sS -A "\${A-Mozilla}" "$1" | query 'p' 'first' |w3m -T text/html -dump| cut -c -750