editting files via ripper

This commit is contained in:
Alexander Bocken 2021-06-27 22:31:01 +02:00
parent 08a6cdc508
commit 3f8c49ed1b
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8

18
ripper
View File

@ -7,8 +7,7 @@
#Keep this in mind when running it as a cronjob #Keep this in mind when running it as a cronjob
#Either insert this key in plain text below at the variable "APIKEY" or do it via ENV vars or a password manager #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. #Since bitchute still doesn't have an API I'm using lynx to emulate a user.
#This can limit the number of recent videos available. For a whole download of bitchute channels consider other methods first. #This can limit the number of recent videos available. For a whole download of bitchute channels consider other methods first. #For youtube the videos per channel are limited to the last 500 uploaded videos (via API).
#For youtube the videos per channel are limited to the last 500 uploaded videos (via API).
#Without API access it's limited to the last 15 videos. #Without API access it's limited to the last 15 videos.
#For the rest you can just use youtube-dl with `youtube-dl <channel>` #For the rest you can just use youtube-dl with `youtube-dl <channel>`
@ -37,6 +36,19 @@ export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0"
APIKEY="$(pass show Misc/Youtube\ Data\ API\ v3 | head -n1)" APIKEY="$(pass show Misc/Youtube\ Data\ API\ v3 | head -n1)"
LEGACYMODE=$1 #set to anything nonzero to ignore YT API LEGACYMODE=$1 #set to anything nonzero to ignore YT API
if [ "$1" = "edit" ]; then
case $2 in
"blacklist") ${EDITOR:-vim} "$BLACKLIST";;
"channels") ${EDITOR:-vim} "$CHANNELSFILE";;
"downloaded") ${EDITOR:-vim} "$DLARCHIVE";;
*) printf "invalid argument. options:\nedit blacklist/channels/downloaded\n";;
esac
exit
fi
[ -z "$APIKEY" ] && LEGACYMODE=1 [ -z "$APIKEY" ] && LEGACYMODE=1
[ -n "$LEGACYMODE" ] && printf "Using YT Legacy fallback mode...\nThis is less reliable than the API requests.\nOnly expect to find the last 15 videos or so per channel\n" [ -n "$LEGACYMODE" ] && printf "Using YT Legacy fallback mode...\nThis is less reliable than the API requests.\nOnly expect to find the last 15 videos or so per channel\n"
if [ "$(pgrep -c ripper)" -gt 1 ]; then if [ "$(pgrep -c ripper)" -gt 1 ]; then
@ -109,7 +121,7 @@ grep 'bitchute' "$DLARCHIVE" | sed 's/bitchute /https:\/\/www\.bitchute\.com\/vi
##PEERTUBE ##PEERTUBE
echo "Scanning Peertube instances..." echo "Scanning Peertube instances..."
PT_CHANNELS="$(grep -Ev '(bitchute|youtube)' $CHANNELSFILE | grep -v '^#')" PT_CHANNELS="$(grep -Ev '(bitchute|youtube)' "$CHANNELSFILE" | grep -v '^#')"
for channel in $PT_CHANNELS; do for channel in $PT_CHANNELS; do
printf 'PT channel: %s\n' "$channel" printf 'PT channel: %s\n' "$channel"
channelxml="$(curl -s "$channel")" channelxml="$(curl -s "$channel")"