Add screenshot grabbing for twitter URIs and the tools needed. - annna - Annna … | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
commit 99ae2e7abf7c4868719d6ec1ff449390c36148d6 | |
parent a78100019f56bcf3c6a8b8c3bf95b9d883c4d8bc | |
Author: Annna Robert-Houdin <[email protected]> | |
Date: Sun, 19 Jan 2020 16:29:23 +0100 | |
Add screenshot grabbing for twitter URIs and the tools needed. | |
Diffstat: | |
M annna-start-services | 16 +++++++++++++++- | |
A screenshot-paste | 15 +++++++++++++++ | |
A screenshot-url | 28 ++++++++++++++++++++++++++++ | |
3 files changed, 58 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/annna-start-services b/annna-start-services | |
@@ -118,8 +118,22 @@ then | |
then | |
annna-say -c "#bitreic… | |
else | |
+ case "${uri}" in | |
+ *twitter.com*) | |
+ spurl="$(scree… | |
+ ;; | |
+ *) | |
+ spurl="" | |
+ ;; | |
+ esac | |
+ | |
purl="$(9 htmlfmt < "$… | |
- annna-say -c "#bitreic… | |
+ if [ -n "${spurl}" ]; | |
+ then | |
+ annna-say -c "… | |
+ else | |
+ annna-say -c "… | |
+ fi | |
fi | |
;; | |
esac | |
diff --git a/screenshot-paste b/screenshot-paste | |
@@ -0,0 +1,15 @@ | |
+#!/bin/sh | |
+ | |
+export PATH="/home/annna/bin:$PATH" | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s url\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+pastepath="$(screenshot-url "$1")" | |
+pastefile="$(basename "${pastepath}")" | |
+ | |
+printf "gopher://bitreich.org/I/p/%s\n" "${pastefile}" | |
+ | |
diff --git a/screenshot-url b/screenshot-url | |
@@ -0,0 +1,28 @@ | |
+#!/bin/sh | |
+ | |
+if [ $# -lt 1 ]; | |
+then | |
+ printf "usage: %s url\n" "$(basename "$0")" >&2 | |
+ exit 1 | |
+fi | |
+ | |
+# Use Tor. | |
+proxy="socks5://127.0.0.1:9100" | |
+#proxy="" | |
+export http_proxy="${proxy}" | |
+export https_proxy="${proxy}" | |
+export socks_proxy="${proxy}" | |
+ | |
+url="$1" | |
+firefoxargs="--window-size=1024,768" | |
+pastebase="/br/gopher/paste" | |
+ | |
+cd "${pastebase}" | |
+tmpfile="$(mktemp p-XXXXXXXXXXXXX.png)" | |
+firefox $firefoxargs --screenshot "${pastebase}/${tmpfile}" "${url}" 2>&1 >/de… | |
+ | |
+# Firefox stores with rw---- | |
+chmod g+wr "${pastebase}/${tmpfile}" | |
+ | |
+printf "%s/%s\n" "${pastebase}" "${tmpfile}" | |
+ |