fixed web archive returning private videos
This commit is contained in:
		
							parent
							
								
									209f38200a
								
							
						
					
					
						commit
						bc80cdbbe6
					
				
							
								
								
									
										12
									
								
								yt
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								yt
									
									
									
									
									
								
							@ -54,8 +54,8 @@ cache() { # cache the video title for faster retrieval
 | 
				
			|||||||
	done
 | 
						done
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clone() { # clones a YouTube playlist in m3u format
 | 
					clone() { # clones a YouTube playlist to a file
 | 
				
			||||||
	yt-dlp --flat-playlist "$1" --print url > "$2.m3u"
 | 
						yt-dlp --flat-playlist "$1" --print url > "$2"
 | 
				
			||||||
	verify "$2.m3u"
 | 
						verify "$2.m3u"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for line in $(cat "$2.m3u")
 | 
						for line in $(cat "$2.m3u")
 | 
				
			||||||
@ -130,10 +130,12 @@ verify() { # replaces videos with archived versions if they are not available
 | 
				
			|||||||
				printf "%s: %s: Video unavailable.\n" "$argv0" "$video" 1>&2
 | 
									printf "%s: %s: Video unavailable.\n" "$argv0" "$video" 1>&2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				wayback_url="$(curl -s "$WBAPI$video" \
 | 
									wayback_url="$(curl -s "$WBAPI$video" \
 | 
				
			||||||
					| jq .archived_snapshots.closest.url \
 | 
										| jq -r .archived_snapshots.closest.url \
 | 
				
			||||||
					| tr -d '"' | sed 's/^http:/https:/g')"
 | 
										| sed 's/^http:/https:/g')"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if [ "$wayback_url" = "null" ]; then
 | 
									if [ "$wayback_url" = "null" ] \
 | 
				
			||||||
 | 
										&& test -n "$(yt-dlp -s "$wayback_url" 2>&1 | grep -e 'not archived')"
 | 
				
			||||||
 | 
									then
 | 
				
			||||||
					printf "%s: %s is not available on the Wayback Machine.\n" \
 | 
										printf "%s: %s is not available on the Wayback Machine.\n" \
 | 
				
			||||||
						"$argv0" "$video" 1>&2
 | 
											"$argv0" "$video" 1>&2
 | 
				
			||||||
					# replace the video link with a comment containing link
 | 
										# replace the video link with a comment containing link
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user