Last active
June 2, 2023 22:35
-
-
Save nsapa/cf6f50d04e2f84f91bbf57cc7cd4151b to your computer and use it in GitHub Desktop.
Checking if tubeup have done the work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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