stop rate limiting me web archive >:(

This commit is contained in:
Emma Tebibyte 2023-11-03 15:31:56 -06:00
parent 6bbd07dc16
commit 209f38200a
Signed by: emma
GPG Key ID: 6D661C738815E7DD
2 changed files with 16 additions and 2 deletions

5
README
View File

@ -9,11 +9,14 @@ Dependencies:
- yt-dlp(1)
Usage:
yt add | clone | music | pick | play | verify
yt add | archive | cache | clone | music | pick | play | queue | verify
add uri file
- Adds a video by URI to a playlist
archive uri...
- Archives a video on the Wayback Machine
cache uri...
- Caches a video title

13
yt
View File

@ -35,6 +35,12 @@ add() { # adds a video to a playlist file
archive() { # archives a video to the Wayback Machine
while test -n "$1"; do
wayback_url="$(curl -s "$WBAPI$1" \
| jq .archived_snapshots.closest.url \
| tr -d '"' | sed 's/^http:/https:/g')"
if [ "$wayback_url" != "null" ]; then continue fi
curl -s -d "url=$1" https://web.archive.org/{url} >/dev/null
shift
done
@ -58,7 +64,8 @@ clone() { # clones a YouTube playlist in m3u format
| sed -n -e '/web\.archive\.org/p' -e '/^\#/p')"
then
continue
else
fi
printf "%s: %s: Saving video to the Wayback Machine.\n" "$argv0" "$1" 1>&2
archive "$line"
fi
done
@ -177,6 +184,10 @@ case "$com" in
shift 2>/dev/null || usage 'add uri file'
add "$@"
;;
archive)
shift 2>/dev/null || usage 'archive uri...'
archive "$@"
;;
cache)
shift 2>/dev/null || usage 'cache uri...'
cache "$@"