New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Login fails/age-restriction #31034
Comments
The verbose log would still be useful. |
Duplicate of #29811. As a rule, the login function of any extractor is liable to break because sites change the procedure, by adding captchas or whatever. If the login function doesn't succeed, or even always, omit I have an open dev branch for this issue but the situation was too fluid at the time to progress it. Maybe now.
This is the sort of thing that dev branch does. Is this the normal n-parameter throttling? The side-effect of using different player data is that different sets of format sets are extracted; however, that's probably better than nothing at all.
Is this bearer token something we have to guess, or can it be extracted from the player (presumably), or is it fixed for as long as no-one at YT changes it?
As proposed above? The cookies have to be associated with a login that passes whatever restriction YT wishes to impose. |
The pytube implementation could be used but both it and exchange.go require someone to operate a browser alongside the downloader which is not a big improvement on the cookie procedure, even if it doesn't actually need G login. Surely there must be a way of extracting and posting the so-called |
Yes, thanks. The problem we're trying to solve is to be able to finesse the YT age restriction without providing a YT login by which the user can be tracked. This should be a solution that doesn't require personally identifiable information to be provided and can be implemented entirely within yt-dl. If the user has to open a browser to log in to G and then respond to some challenge, we've lost, even if the OAuth method might mean that the video access transaction can't directly be linked to the user. Formerly at least some age restricted videos could be accessed by specifying certain player details and/or using the embed version of the video URL. The inability to reproduce that now is why my dev branch is still only that and not a commit or a PR. Looking at yt-dlp, the age-gate bypass now depends on the user being recognised as logged-in. If yt-dlp hasn't cracked it, I'm unlikely to spend more time on it. But brainwaves are always welcome. |
Surely everyone who wants Cr381pDsSsA already has it? The benefit of the cookie solution is that is already implemented and understood, even if yt-dlp's If there is a subset of age-restricted videos that can be accessed using some player details based on --- old/youtube_dl/extractor/youtube.py
+++ new/youtube_dl/extractor/youtube.py
@@ -1631,31 +1631,47 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
player_response = self._call_api(
'player', {'videoId': video_id}, video_id)
+ def is_agegated(playability):
+ if not isinstance(playability, dict):
+ return
+
+ if playability.get('desktopLegacyAgeGateReason'):
+ return True
+
+ reasons = filter(None, (playability.get(r) for r in ('status', 'reason')))
+ AGE_GATE_REASONS = (
+ 'confirm your age', 'age-restricted', 'inappropriate', # reason
+ 'age_verification_required', 'age_check_required', # status
+ )
+ return any(expected in reason for expected in AGE_GATE_REASONS for reason in reasons)
+
def get_playability_status(response):
return try_get(response, lambda x: x['playabilityStatus'], dict) or {}
playability_status = get_playability_status(player_response)
- if (playability_status.get('reason') == 'Sign in to confirm your age'
+ if (is_agegated(playability_status)
and int_or_none(self._downloader.params.get('age_limit'), default=18) >= 18):
+
self.report_age_confirmation()
query = {
'playbackContext': {'contentPlaybackContext': {'html5Preference': 'HTML5_PREF_WANTS'}},
'contentCheckOk': True,
'racyCheckOk': True,
'context': {
- 'client': {'clientName': 'ANDROID', 'clientVersion': '16.20', 'hl': 'en', 'clientScreen': 'EMBED'},
+ 'client': {'clientName': 'TVHTML5_SIMPLY_EMBEDDED_PLAYER', 'clientVersion': '2.0', 'hl': 'en', 'clientScreen': 'EMBED'},
'thirdParty': {'embedUrl': 'https://google.com'},
},
'videoId': video_id,
}
headers = {
- 'X-YouTube-Client-Name': '3',
- 'X-YouTube-Client-Version': '16.20',
+ 'X-YouTube-Client-Name': '85',
+ 'X-YouTube-Client-Version': '2.0',
'Origin': 'https://www.youtube.com'
}
+
video_info = self._call_api('player', query, video_id, fatal=False, headers=headers)
age_gate_status = get_playability_status(video_info)
- if age_gate_status.get('status') == 'OK':
+ if not is_agegated(age_gate_status):
player_response = video_info
playability_status = age_gate_status |
Yes, it didn't work with the right Android version number either: my diff is against last December's attempt. The Example links, first from
These parameters differ (1 vs 2):
|
@dirkf Your API call with
@89z You never suggested this or had any input to its implementation afair!! In fact, you only ever opposed it (#29201 (comment)) claiming "oauth is better" as always |
So it is. I wonder why the defective API data is OK with HtVdAasjOgU but 403 for HsUATh_Nc2U. |
With @dirkf not being able to make a new release since he started maintaining this repo, together with this grifter who deletes all his posts for god knows whatever reason, one starts to question what is even the point of this repo being resuscitated to begin with. Perhaps @rg3 might wanna consider shutting it all down for good, because holy shit, very little is happening. |
Damn, my long going github ruse was exposed. |
Probably because only the latter uses a rolling cipher ( |
I have followed the checklist, and really need some help, I can't figure this out myself. :((((
Hello, I have looked and tried all apparent workarounds to age-restricted videos, and haven't gotten any to work. I'm using Win10 command prompt. I'd like to download a playlist of my own age-restricted favorites that I've pulled out as time has gone by, but even singe videos, it doesn't work. I just can't log in, getting a 400 error no matter what. I've also tried to just enter the username, and then password when prompted, but that method, for some reason I can't type anything at all and have to close CMD altogether.
The text was updated successfully, but these errors were encountered: