Bypass YouTube age verification

Bypass YouTube age verification without logging in.

As of 2015-08-22. See the latest version.

  1. // ==UserScript==
  2. // @name Bypass YouTube age verification
  3. // @name:de Youtube-Altersverifikation umgehen
  4. // @namespace tfr
  5. // @description Bypass YouTube age verification without logging in.
  6. // @description:de Umgehe die Altersverifikation ohne Einloggen.
  7. // @author tfr (https://github.com/t-fr/)
  8. // @license CC0; https://creativecommons.org/publicdomain/zero/1.0/
  9. // @license MIT license; https://pastebin.com/raw.php?i=4TMeeUXC
  10. // @compatible firefox Works with Firefox and Greasemonkey
  11. // @compatible chrome Works with Chrome and Tampermonkey
  12. // @compatible opera Works with Opera and Tampermonkey Beta or Violent monkey
  13. // @oujs:author tfr
  14. // @include http://www.youtube.com/watch*
  15. // @include https://www.youtube.com/watch*
  16. // @version 6
  17. // @grant none
  18. // ==/UserScript==
  19.  
  20. /* This script is dual-licensed under CC0 and the MIT license.
  21. * You can choose which one you want to use.
  22. * CC0 license: http://creativecommons.org/publicdomain/zero/1.0/deed.en
  23. * MIT license: https://pastebin.com/raw.php?i=4TMeeUXC
  24. *
  25. * Dieses Skript steht sowohl unter CC0 als auch unter der MIT-Lizenz.
  26. * Sie können sich aussuchen, welche Lizenz Sie nutzen.
  27. * CC0-Lizenz: http://creativecommons.org/publicdomain/zero/1.0/deed.de
  28. * MIT-Lizenz: https://pastebin.com/raw.php?i=4TMeeUXC
  29. */
  30.  
  31. /* Version 6: Update license information
  32. * Version 5: Update metadata block
  33. * Version 4: Correct string search index from 1 to -1
  34. * Version 3: https://greatest.deepsurf.us/forum/discussion/4509
  35. * Version 2: Error in code, bypass in playlists was not working
  36. */
  37.  
  38. if(window.document.getElementById("watch7-player-age-gate-content"))
  39. {
  40. var videoid = window.location.search.substr(window.location.search.indexOf("v=") + 2);
  41. if(videoid.indexOf("&") > -1)
  42. {
  43. videoid = videoid.substr(0, videoid.indexOf("&"));
  44. }
  45. videoid = decodeURIComponent(videoid);
  46. window.document.getElementById("player-api").remove();
  47. var playerparent = window.document.getElementById("player-unavailable");
  48. var playerframe = window.document.createElement("iframe");
  49. playerframe.setAttribute("src", "//www.youtube.com/embed/" + videoid + "?autoplay=1&showinfo=0");
  50. playerframe.setAttribute("id", "player-frame");
  51. playerframe.setAttribute("style", "position:absolute; z-index:99999; width:100%; height:100%;");
  52. playerparent.appendChild(playerframe);
  53. }