Youtube Age Confirmation Bypass

Prevents you from having to sign in to view age restricted videos on YouTube

目前为 2014-08-13 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube Age Confirmation Bypass
  3. // @namespace kneels
  4. // @description Prevents you from having to sign in to view age restricted videos on YouTube
  5. // @include https://www.youtube.*/watch*
  6. // @include http://*.youtube.*/watch*
  7. // @include https://*.youtube.*/watch*
  8. // @match http://*.youtube.*/watch*
  9. // @match https://*.youtube.*/watch*
  10. // @version 1.3
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. var el = document.getElementById('unavailable-submessage');
  15.  
  16. if(el.hasChildNodes()) {
  17. var embedString = "<iframe width=\"100%\" height=\"100%\" src='" +
  18. getEmbedUrl() +
  19. "?autoplay=1' frameborder=\"0\" allowfullscreen></iframe>";
  20. document.getElementById('player-unavailable').innerHTML = embedString;
  21. }
  22.  
  23. function getEmbedUrl()
  24. {
  25. var urlStr = window.location.href.replace('watch?v=', 'embed/');
  26. var junk = urlStr.indexOf("&");
  27. if(junk != -1) {
  28. urlStr = urlStr.substr(0, junk);
  29. }
  30. return urlStr;
  31. };