Tyrrrz / YoutubeDownloader

Downloads videos and playlists from YouTube
MIT License
8.18k stars 1.15k forks source link

Add login information and store for all downloads #198

Closed NeilMJohnson closed 1 year ago

NeilMJohnson commented 3 years ago

It would be a good workaround for the Age-restricted videos if we could store our username/password in YoutubeDownloader and add a button that says something like [Add login info]. This would then append the security info to the request and hopefully look like a login has taken place.

Skaamit commented 3 years ago

Yes. It very needed.

derech1e commented 3 years ago

I think this will be against Youtube's TOS. If you use Youtube without an account, to my knowledge you do not agree to the TOS. I am not sure if implementing this function violates the guidelines. That would have to be examined more closely, in my opinion.

DaveCS1 commented 3 years ago

As derech1e stated, it's a TOS violation. See https://www.youtube.com/static?template=terms Section one. "The following restrictions apply to your use of the Service. You are not allowed to: access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content..." Section 3. "access the Service using any automated means (such as robots, botnets or scrapers) except (a) in the case of public search engines, in accordance with YouTube’s robots.txt file;..."

I've been using Tyrrrz's tools for a long time and honestly surprised his youtubeexplode library has lasted as long as it has. Trying to bypass authentication might just be pushing it too far and create real problems and many project issues to deal with. There is no need to ruin a great thing.

If you want to implement age restricted videos into the youtubeexplode library I would recommend creating some custom functions and testing those. I've read that if one uses an embed link etc. to an age restricted video it may be possible to bypass the age restrictions. However all of these methods seem to be unreliable .

There are other repositories here on github that perform similar functions but they are all fraught with issues, maybe you can find a method to bypass the age restrictions from one of those repositories. See https://github.com/FreeTubeApp/FreeTube for example. As of this writing there are 226 issues .

Another option is to use the API or borrow and convert code from https://github.com/iv-org/invidious (230+ issues) to create your own methods in youtubeexplode.

A third reference is https://github.com/blackjack4494/yt-dlc. From reading in the issues there it seems one has to pass cookies to the http request to access age restricted videos. Perhaps you can find relevant code in that project to help you.

Finally, perhaps you can find methods on google https://www.google.com/search?q=view+age+restricted+video+on+youtube that you can implement into your code.

Tyrrrz commented 3 years ago

I've been using Tyrrrz's tools for a long time and honestly surprised his youtubeexplode library has lasted as long as it has.

Me too. But youtube-dl set an important precedent last year: https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/ I'm not sure if youtube-dl has a way to make authenticated requests.

DaveCS1 commented 3 years ago

Me too. But youtube-dl set an important precedent last year: https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/

I'm not sure if youtube-dl has a way to make authenticated requests.

Indeed, I was aware of the takedown and subsequent reinstatement but didn't know the details so thanks for the link. I like to see github take the stance they are.

From what I've read on the second repo I refenced (yt-dlc), a fork of youtube-dl, they store cookie info from a successful login and later pass it via a text file argument. I'm not sure if if youtube-dl utilizes the same approach.

What separates youtube explode from the rest is that other than basic updates due to the html structure changes at yt it works reliably unlike other libraries that try to put too many features in. I'd also imagine and think I recall from reading your blogs, youtube explode cannot be in constant development with newer and newer features. I think it's great how it is and if one wants to do something extra fork it and make it happen. Thanks for your reply.

Tyrrrz commented 3 years ago

What separates youtube explode from the rest is that other than basic updates due to the html structure changes at yt it works reliably unlike other libraries that try to put too many features in. I'd also imagine and think I recall from reading your blogs, youtube explode cannot be in constant development with newer and newer features. I think it's great how it is and if one wants to do something extra fork it and make it happen.

Yeah, that's right. To be honest just maintaining it is already stressful enough (it's been around for almost 5 years now 😬), so I want to limit the feature set as much as possible.

However, it's important to note that making authenticated requests is already possible with YoutubeExplode, albeit at a very low level, by providing a custom pre-authenticated HttpClient instance. So if such a feature will be implemented, most likely all of it will be on YoutubeDownloader's side.