Add checking archive.org, if some site fails. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit abc30b0ab170e1310f8f65195ab4bfcbbb5fa89a DIR parent 5653768e47a7001b2078713bdac855661fa867c3 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 12 Jan 2025 18:14:55 +0100 Add checking archive.org, if some site fails. Diffstat: M fetch-uri | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- DIR diff --git a/fetch-uri b/fetch-uri @@ -29,4 +29,15 @@ case "$beg" in *) host="$beg" esac grep -qx "$host" "/home/annna/bin/modules/tor/whitelist-from-tor" || usetor=1 -curl -qgsm 5 -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$uri" +curl -qgsm 5 --fail -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$uri" + +# Taken from: https://github.com/uriel1998/muna/blob/master/muna.sh +if [ $? -eq 22 ]; +then + aiapiuri="http://archive.org/wayback/available?url=${uri}" + apiai="$(curl -qgsm 5 --fail -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$aiapiuri")" + notavailable="$(echo "$apiia" | grep -c -e '"archived_snapshots": {}')" + aiuri="$(echo "$apiia" | awk -F 'url": "' '{print $3}' 2>/dev/null | awk -F '", "' '{print $1}' | awk -F '"' '{print $1}')" + curl -qgsm 5 --fail -L --max-redirs 3 -A "$ua" $opth ${usetor:+--preproxy socks5h://127.0.0.1:9050 }"$aiuri" +fi +