Add check, if some snapshot is available on archive.org. - 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 9c3d93e2271e8d2f98834aace8ab44a147ed28cb DIR parent abc30b0ab170e1310f8f65195ab4bfcbbb5fa89a HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 12 Jan 2025 18:19:41 +0100 Add check, if some snapshot is available on archive.org. Diffstat: M fetch-uri | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- DIR diff --git a/fetch-uri b/fetch-uri @@ -1,5 +1,7 @@ #!/bin/sh +set -x + export PATH="$HOME/bin:$PATH" usage() { @@ -37,7 +39,10 @@ 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" + if [ -z "${notavailable}" ]; + then + 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 fi