If you open a link to a YouTube video or channel on a fresh browser you'll get this pop up:
https://i.stack.imgur.com/tU8lT.png
Is there something you can add to the end (or middle!) of that URL that will automatically skip that page?
Use case: I'm automatically displaying a user supplied YouTube like in the built in Unreal 4 web browser and it breaks because this screen now comes up.
CodePudding user response:
Either when selecting REJECT ALL
or ACCEPT ALL
YouTube sets a cookie called SOCS
to the value CAESEwgDEgk0ODE3Nzk3MjQaAmVuIAEaBgiA_LyaBg
that is encoded in base64. As far as I know the only way to get rid of the consent screen is to pass this cookie when requesting the webpage.
You can verify my answer by running:
curl 'https://www.youtube.com' -H 'Accept-Language: en' | grep 'We use' | wc -l
Note that We use
is the start of We use cookies and data to
of the consent screen.
You'll get 1
which means that the consent screen is present with such a simple request.
While with:
curl 'https://www.youtube.com' -H 'Accept-Language: en' -H 'Cookie: SOCS=CAESEwgDEgk0ODE3Nzk3MjQaAmVuIAEaBgiA_LyaBg' | grep 'We use' | wc -l
You'll get 0
which means that the consent screen is absent.
CodePudding user response:
If you don't need the surrounding YouTube interface, and just want to show the video, you can display the "embedded" version. Replace the watch?v=
in the URL with embed/
.
Here's some javascript, as a bookmarklet:
javascript:(function(){window.location = window.location.toString().replace('watch?v=', 'embed/').replace(/&[\s\S]*/, '');})()