modified: .config/lf/lfrc modified: .config/mpd/playlists/lofi.m3u deleted: .config/mpd/playlists/lofi2.m3u modified: .config/qutebrowser/autoconfig.yml modified: .config/qutebrowser/bookmarks/urls modified: .config/qutebrowser/qsettings/QtProject.conf modified: .config/xprofile deleted: .local/bin/dropdowncalc modified: .local/bin/statusbar/cpu modified: .local/bin/statusbar/music modified: .local/bin/tools/ripper
		
			
				
	
	
		
			44 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			2.4 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/zsh
 | 
						|
 | 
						|
#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
 | 
						|
 | 
						|
 | 
						|
#STILL NOT WORKING
 | 
						|
# Required to display notifications if run as a cronjob:
 | 
						|
export XAUTHORITY="/home/alex/.cache/xdg_run/Xauthority" # This line will break some DMs.
 | 
						|
export DISPLAY=:0.0
 | 
						|
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
 | 
						|
 | 
						|
range="now-40years"
 | 
						|
notify-send "Channel Ripper" "Scanning for new Videos to download"
 | 
						|
echo "Scanning for new Videos to download"
 | 
						|
grep 'youtube' "$CHANNELSFILE" | sed "s/$/\/videos/" |xargs -L1 lynx --dump --nonumbers -listonly $1 | grep "youtube.com/watch?v=" | grep -v "&list" > /tmp/todownload
 | 
						|
grep 'youtube' "$DLARCHIVE" | sed 's/youtube /https:\/\/www\.youtube\.com\/watch?v=/' > /tmp/alreadydownloaded
 | 
						|
 | 
						|
grep 'bitchute' "$CHANNELSFILE" | xargs -L1 lynx --dump --nonumbers -listonly $1 | grep 'bitchute\.com\/video' | sort -u >> /tmp/todownload
 | 
						|
grep 'bitchute' "$DLARCHIVE" | sed 's/bitchute /https:\/\/www\.bitchute\.com\/video\//' >> /tmp/alreadydownloaded
 | 
						|
 | 
						|
number=$(grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | wc -l)
 | 
						|
 | 
						|
if [ $number -gt 0 ]; then
 | 
						|
	[ $number -eq 1 ] && ( notify-send "Channel Ripper" "1 new video available for download, downloading now." ) || ( notify-send "Channel Ripper" "$number new videos available for download, downloading now." )
 | 
						|
	echo  "$number new videos for download available, downloading now."
 | 
						|
	grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | xargs -L1 youtube-dl --get-filename -o "'%(uploader)s' '%(title)s'" $1 | xargs -L1 notify-send
 | 
						|
	grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'youtube' | xargs -r -L1 youtube-dl --hls-prefer-native -i --download-archive $DLARCHIVE --dateafter $range -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' --add-metadata -o "$DLLOC/%(uploader)s/%(upload_date)s-%(title)s.%(ext)s"
 | 
						|
	grep -vf /tmp/alreadydownloaded /tmp/todownload | sort -u | grep 'bitchute' | xargs -r -L1 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"
 | 
						|
	notify-send "Channel Ripper" "Finished downloading"
 | 
						|
fi
 | 
						|
 | 
						|
if [ $number -eq 0 ]; then
 | 
						|
	echo "No new Videos"
 | 
						|
	notify-send "Channel Ripper" "No new Videos"
 | 
						|
fi
 | 
						|
 | 
						|
rm -f /tmp/alreadydownloaded
 | 
						|
rm -f /tmp/todownload
 |