From time to time I come across a video on YouTube that wont play because I am not logged in, so YT cannot verify that I am an adult. However, for various reasons, I sometimes do not want to log in, yet I still want to watch the video.
When videos are embedded, the age verification does not work and anyone can watch anything. For quite some time I kept a .html file on my desktop that I would edit to embed restricted videos. But I grew too lazy to do that, so I wrote a bash script that would do the work for me.
I only need to copy the code from the URL (right after v=) and hand it over to the script. It will then create the .html file, make the browser open it and, as it is no longer needed, remove the file.
#!/bin/bash read -p "Please paste the alphanumerical ID of the YT video. " code echo -e '<html>\n<head>\n<title>trespassing</title>\n</head>\n<body>\n<iframe width="560" height="315" src="https://www.youtube.com/embed/'$code'" frameborder="0" allowfullscreen></iframe>\n</body>\n</html>' > $code.html firefox -new-tab -url $code.html # edit this line to match your favorite web browser sleep 5 rm $code.html exit