TheRealJoelmatic / RemoveAdblockThing

The intrusive "Ad blocker are not allowed on YouTube" message is annoying. This open-source project aims to address this issue by providing a solution to bypass YouTube's ad blocker detection
http://joelmatic.com/
MIT License
6.06k stars 330 forks source link

Lack of cookies (and maybe possible solution) #575

Closed CatPieLeaf closed 3 months ago

CatPieLeaf commented 3 months ago

The player embed is coming with no cookies. Accessing private videos, private playlists and other stuff might not be possible.

But, i've found something that may make this possible instead of using youtube.com/embed, which displays a black screen in the website, or youtube-nocookie.com, what about YT iframe API?

Documentation: https://developers.google.com/youtube/player_parameters#IFrame_Player_API

<div id="ytplayer"></div>

<script>
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/player_api";

  var head = document.getElementsByTagName('head')[0];

  head.appendChild(tag);

  var videoID = 'wDgQdr8ZkTw';
  var timeStamp = 0;
  var playListID = '';

  function onYouTubePlayerAPIReady() {
    player = new YT.Player(document.getElementById('ytplayer'), {
      height: '360',
      width: '640',
      videoId: videoID,
      playerVars: {
        'autoplay': 1,
        'enablejsapi': 1,
        'fs': 1,
        'listType': 'playlist',
        //'list': playListID,
        'start': timeStamp
      }
    });
  }
</script>