Monthly Archives: January 2015

Tampermonkey – Youtube URL Rewrite Script

Hello everyone. Welcome to my first post of the year. Like last year I will try my best to share useful information with you. So here we go:

I think everyone of us got annoyed by age restricted videos at least once in our life and saw a screen like this which told us to log in:


(Sorry for the german screenshot.) Since I do not want to log in to watch a restricted video I tried to come up with a solution. Some of you might know this trick here. The trick is simple. Replace “watch?v=” with “v/” to circumvent the age restriction check. Not too much work but I wanted something better.

So I decided to use Tampermonkey, an extension for Google Chrome, to add custom Javascripts to websites to alter them. Here is a screenshot of the Tampermonkey Dashboard: (If you are using Firefox you can use Greasemonkey . The same script will also work in Greasemonkey.)


And here is my script which will do the work for me:

// ==UserScript==
// @name Youtube URL Rewrite Script
// @namespace
// @version 1.0
// @description This script will rewrite Youtube URLs when pasted into the address bar of the browser or when the page is refreshed to unblock age restricted videos without the need to log in.
// @author theezitguy
// @include *://*
// @grant none
// ==/UserScript==

var current_url = document.location;
var video_id ='v=')[1];
var new_url = "" + video_id;

The script does the following: When you paste a Youtube Video Link into your address bar it will rewrite the URL. However if you click on a video on Youtube the script will only be triggered if you reload the page. Not perfect but I didn´t find a solution for this. (If you know a solution for this I would be grateful if you could post it in the comments section.)

If you want to try out the script here is a SFW video:


That´s it. Now you can use this script to watch age restricted videos without to log in to Youtube or to alter the URL manually. I hope you liked my today´s post and I hope you can use this knowledge to improve your web experience with your own scripts. I hope to see you again next time 🙂