Release an experimental script that check which videos were deleted from YouTube (Closes #65)

master
TheFrenchGhosty 1 month ago
parent 40907abfb2
commit 0a87b343fb
No known key found for this signature in database
GPG Key ID: 4E616F0FFE25B75B

@ -0,0 +1,35 @@
#!/bin/bash
#
# TheFrenchGhosty's Ultimate YouTube-DL Scripts Collection: The ultimate collection of scripts for YouTube-DL
# https://github.com/TheFrenchGhosty/TheFrenchGhostys-Ultimate-YouTube-DL-Scripts-Collection
# https://github.com/TheFrenchGhosty
#
# Version: EXPERIMENTAL
#
output_file="unavailable_videos.txt"
# Function to extract YouTube video IDs from filenames
get_video_ids() {
find . -type f -name "*\[*\].mkv" | sed 's/.*\[//;s/\].mkv$//'
}
# Check if a YouTube video is still available
is_video_available() {
video_id="$1"
if yt-dlp -e "https://www.youtube.com/watch?v=${video_id}" >/dev/null 2>&1; then
return 0 # Available
else
return 1 # Unavailable
fi
}
# Main loop
for video_id in $(get_video_ids); do
if ! is_video_available "$video_id"; then
echo "$video_id" >> "$output_file"
fi
done
echo "Unavailable YouTube video IDs have been saved to $output_file"

@ -0,0 +1,28 @@
# Check Availability Script
An experimental script that check if the downloaded videos are still available on YouTube.
See the reasoning in: https://github.com/TheFrenchGhosty/TheFrenchGhostys-Ultimate-YouTube-DL-Scripts-Collection/issues/65
This scripts only supports YouTube, running it on a folder that contain videos from other source will just make those videos appear as not available on YouTube.
This script was made with ChatGPT 3 and fixed by hand.
Prompt: "I have a lot of files named "file [youtube video ID].mkv". Make a bash script that recursively get those youtube videos ID and check if those videos are still available on youtube. If they aren't, output the ID to a text file."
# Usage
Copy this script next to the download script and run it.
The list of available videos will be outputed to `unavailable_videos.txt` next to the script.
# Warning
This script is highly experimental and hasn't been as extensively tested as the other scripts.
Nothing bad should happen, however, use it at your own risk.
If you do run it and notice any bug with it, please open an issue.
Loading…
Cancel
Save