From e8b5d81bd22561197898159e5a1ffe1c6dbbed87 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 1 Jan 2021 19:22:03 +0100 Subject: [PATCH] added docs --- .local/bin/tools/ripper | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.local/bin/tools/ripper b/.local/bin/tools/ripper index 202e73c..45de00a 100755 --- a/.local/bin/tools/ripper +++ b/.local/bin/tools/ripper @@ -1,9 +1,20 @@ #!/bin/bash +#A script that checks multiple youtube and bitchute channels for new videos to download via youtube-dl +#This script works considerably faster than just giving youtube-dl a channel URI. +#The YouTube implementation now uses a YoutubeData API v3 key to work more reliably. +#Either insert this key in plain text below at the variable "APIKEY" or do it via ENV vars or a password manager +#Since bitchute still doesn't have an API I'm using lynx to emulate a user. +#This can be limit the number of recent videos available. For a whole download of bitchute channels consider other methods first. + #needed if run as cronjob export XDG_VIDEOS_DIR=$HOME/vids DLARCHIVE=$XDG_VIDEOS_DIR/.downloaded DLLOC=$XDG_VIDEOS_DIR CHANNELSFILE=$XDG_VIDEOS_DIR/.channels +#FORMAT OF CHANNELSFILE: +#Youtube: include the channel URI: https://www.youtube.com/channel/ +#Bitchute: normal channel URI: https://www.bitchute.com/channel/ +#Lines starting with '#' will be ignored in this file BLACKLIST=$XDG_VIDEOS_DIR/.blacklist # Required to display notifications if run as a cronjob: @@ -37,6 +48,7 @@ grep 'bitchute' "$CHANNELSFILE" | grep -v '^#' | xargs -L1 lynx --dump --nonumbe grep 'bitchute' "$DLARCHIVE" | sed 's/bitchute /https:\/\/www\.bitchute\.com\/video\//' >> /tmp/alreadydownloaded$$ grep -vf /tmp/alreadydownloaded$$ /tmp/todownload$$ | sort -u > /tmp/new_videos$$ +rm -f /tmp/alreadydownloaded$$ /tmp/todownload$$ number=$(wc -l /tmp/new_videos$$ | cut -d ' ' -f 1 ) if [ $number -gt 0 ]; then [ $number -gt 1 ] && plural="s" @@ -45,7 +57,6 @@ if [ $number -gt 0 ]; then if [ "$number" -lt 10 ];then youtube-dl --get-filename -o "'%(uploader)s' '%(title)s'" -a /tmp/new_videos$$ | xargs -L1 notify-send fi - rm -f /tmp/alreadydownloaded$$ /tmp/todownload$$ youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s" -a /tmp/new_videos$$ rm -f /tmp/new_videos$$ notify-send "Channel Ripper" "Finished downloading" @@ -54,4 +65,3 @@ fi if [ $number -eq 0 ]; then echo "No new videos" fi -rm -f /tmp/alreadydownloaded$$ /tmp/todownload$$