zyrouge / node-youtube-ext

A simple YouTube scraper.
https://youtube-ext.js.org
MIT License
22 stars 5 forks source link

Age restricted youtube url play issue #12

Closed CursedHorus closed 1 year ago

CursedHorus commented 1 year ago

Hi,

I'm getting the following error on a debug when attempting to get my discord bot to play music from a youtube playlist / song that Youtube has placed a sign in required / age restricted content on.

I've added my session cookie to the header options for the player:

const YOUTUBE_COOKIE = process.env.cookie

client.player = new Player(client, { ytdloptions: { quality: 'highestaudio', highWaterMark: 1 << 25, requestOptions: { headers: { cookie: YOUTUBE_COOKIE, } } } });

Please see my previous case with discord-player on their take on the issue: https://github.com/Androz2091/discord-player/issues/1793

URL attempting to play: https://www.youtube.com/watch?v=7EqnoEljHCw (F You by Dr. Dre)

versions: Node Version: 18.17.0 Discord Player Version: 6.6.2 Discord.js Version: 14.12.0

just looking for the right code / information to either be able to get the app to sign into youtube or accept the cookie / play age restricted content.

Many thanks

zyrouge commented 1 year ago

You should set the requestOptions.headers.cookie. I'm unaware how discord-player does it, so you have to ask this to them. Let me know if this is actually an issue with the library.

zyrouge commented 1 year ago

Additionally, you seem to be using ytdloptions instead of ytdlOptions. This could be an issue. Refer this.

CursedHorus commented 1 year ago

Please mark this as completed.

You are correct about the ytdloptions - apologies for wasting your time on ultimately a spelling mistake on my code!

Working with ytdlOptions.. in the process I've mode from distube/ytdl-core to your youtube-ext streaming library though so silver lining and all that haha :)

Thank you for your time and quick response.

zyrouge commented 1 year ago

No problem. :)