Skip to content

Instantly share code, notes, and snippets.

@nsapa
Last active June 2, 2023 22:35
Show Gist options
  • Save nsapa/cf6f50d04e2f84f91bbf57cc7cd4151b to your computer and use it in GitHub Desktop.
Save nsapa/cf6f50d04e2f84f91bbf57cc7cd4151b to your computer and use it in GitHub Desktop.
Checking if tubeup have done the work
#!/bin/bash
# Check if we have a copy of an youtube item on IA
set -e
function die {
echo $1
exit 2
}
# Usage
[ "$#" -eq 1 ] || die "Usage: $0 url_list"
# Code
cat $1 | while read video_id;do
#Special case of id begininng by -;
if [ "${video_id%-*}" = "" ]
then IA_VIDEO="youtube${video_id}"
else
IA_VIDEO="youtube-${video_id}"
fi
#Getting metadata of the item
IA_METADATA=$(ia metadata ${IA_VIDEO});
if [ "xx${IA_METADATA}" = "xx{}" ];
then echo ${video_id} is missing on IA; continue; fi
IA_VIDEOTYPE=$(echo ${IA_METADATA}|jq .files[].format |grep -v -E '(Metadata|JSON|Archive BitTorrent|Unknown|Thumbnail|h\.264 IA|Item Tile|JPEG)');
echo "${video_id} is on IA with format $(echo ${IA_VIDEOTYPE})";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment