Skip to content
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

Age restriction gate used also when logging in #6448

Open
aldnin opened this issue Aug 3, 2015 · 5 comments
Open

Age restriction gate used also when logging in #6448

aldnin opened this issue Aug 3, 2015 · 5 comments

Comments

@aldnin
Copy link

@aldnin aldnin commented Aug 3, 2015

There is no need for the age restriction gate when logging in, nevertheless it is used in such cases. The age restriction gate can cause issues with embedding rules of videos, therefore it makes it impossible to process a video which is age-restricted, with emedding rules, even when logging in with data which would elminiate the age-restriction.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 3, 2015

Provide concrete examples.

@m-porto
Copy link

@m-porto m-porto commented Aug 11, 2015

aldnin is right

This is related to my problem in #4627, but thread closed rather than reply (after ask for dumb things like the OS, wich is in the debug info provided or if im using xxxx@gmail.com literally as account)

In youtube.py extractor go here:

    if re.search(r'player-age-gate-content">', video_webpage) is not None:
        age_gate = True
        ...

but in this case (embedded + age restriction) must go to else branch

    else:
        age_gate = False
        ...

Example:

youtube-dl -n -c -v "https://www.youtube.com/watch?v=_ujz8dY7EAE"
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-n', u'-c', u'-v', u'https://www.youtube.com/watch?v=_ujz8dY7EAE']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.08.09
[debug] Python version 2.7.10 - Linux-3.16.0-4-amd64-x86_64-with-debian-stretch-sid
[debug] exe versions: avconv 2.6.2, avprobe 2.6.2, ffmpeg 2.6.2, ffprobe 2.6.2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Logging in
[youtube] _ujz8dY7EAE: Downloading webpage
[youtube] _ujz8dY7EAE: Downloading embed webpage
[youtube] _ujz8dY7EAE: Refetching age-gated info webpage
ERROR: _ujz8dY7EAE: YouTube said: Watch this video on YouTube.
Playback on other websites has been disabled by the video owner.
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 655, in extract_info
ie_result = ie.extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 286, in extract
return self._real_extract(url)
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1063, in _real_extract
expected=True, video_id=video_id)
ExtractorError: _ujz8dY7EAE: YouTube said: Watch this video on YouTube.
Playback on other websites has been disabled by the video owner.

Not sure how to put the condition, but if I put this in youtube.py extractor:

    if False and re.search(r'player-age-gate-content">', video_webpage) is not None:
        age_gate = True
        ...

and I do this:

dl = YoutubeDL()
dl.params['username'] = 'xxxx@gmail.com'
dl.params['password'] = 'xxxx'

ie = YoutubeIE(dl)
resultIE = ie.extract('https://www.youtube.com/watch?v=_ujz8dY7EAE')
resultIE['extractor'] = 'youtube'
dl.process_ie_result(resultIE)

I get the video:

[youtube] Downloading login page
[youtube] Logging in
[youtube] _ujz8dY7EAE: Downloading webpage
[youtube] _ujz8dY7EAE: Downloading video info webpage
[youtube] _ujz8dY7EAE: Extracting video information
[youtube] _ujz8dY7EAE: Downloading DASH manifest
WARNING: Your copy of avconv is outdated and unable to properly mux separate video and audio files, youtube-dl will download single file media. Update avconv to version 10-0 or newer to fix this.
[download] Destination: Effy & Cook - Sex Scene (3x01)-_ujz8dY7EAE.mp4

[download] 0.0% of 3.73MiB at Unknown speed ETA Unknown ETA
[download] 0.1% of 3.73MiB at 206.49KiB/s ETA 00:18
[download] 0.2% of 3.73MiB at 475.92KiB/s ETA 00:08
[download] 0.4% of 3.73MiB at 573.54KiB/s ETA 00:06
[download] 0.8% of 3.73MiB at 1.13MiB/s ETA 00:03
[download] 1.6% of 3.73MiB at 1.23MiB/s ETA 00:02
[download] 3.3% of 3.73MiB at 662.95KiB/s ETA 00:05
[download] 6.7% of 3.73MiB at 1.25MiB/s ETA 00:02
[download] 13.4% of 3.73MiB at 1.22MiB/s ETA 00:02
[download] 26.8% of 3.73MiB at 1.26MiB/s ETA 00:02
[download] 53.5% of 3.73MiB at 1.30MiB/s ETA 00:01
[download] 89.5% of 3.73MiB at 1.32MiB/s ETA 00:00
[download] 100.0% of 3.73MiB at 1.33MiB/s ETA 00:00

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 11, 2015

#4627 has been already closed long before you posted in it. We do not track closed issues. As of going the else branch this is not always the case, e.g. http://www.youtube.com/watch?v=6kLq3WMV1nU does only work with age-gate branch.

@m-porto
Copy link

@m-porto m-porto commented Aug 11, 2015

Ok, this works for me:

    # Get video info

    embed_webpage = None
    is_live = None

    retry_embedded = False
    player_age_gate_content = re.search(r'player-age-gate-content">', video_webpage) 

    if  player_age_gate_content is not None:
        age_gate = True

        # We simulate the access to the video from www.youtube.com/v/{video_id}
        # this can be viewed without login into Youtube
        url = proto + '://www.youtube.com/embed/%s' % video_id
        embed_webpage = self._download_webpage(url, video_id, 'Downloading embed webpage')
        data = compat_urllib_parse.urlencode({
            'video_id': video_id,
            'eurl': 'https://youtube.googleapis.com/v/' + video_id,
            'sts': self._search_regex(
                r'"sts"\s*:\s*(\d+)', embed_webpage, 'sts', default=''),
        })
        video_info_url = proto + '://www.youtube.com/get_video_info?' + data
        video_info_webpage = self._download_webpage(
            video_info_url, video_id,
            note='Refetching age-gated info webpage',
            errnote='unable to download video info webpage')
        video_info = compat_parse_qs(video_info_webpage)
        add_dash_mpd(video_info)

        if 'token' not in video_info and 'reason' in video_info and len(video_info['reason']) and 'Playback on other websites has been disabled by the video owner.' in video_info['reason'][0]:
            retry_embedded = True

    if player_age_gate_content is None or retry_embedded:
        age_gate = False
        ...

(Sorry for the edit)

@gnaag
Copy link

@gnaag gnaag commented Jan 19, 2016

I have problems downloading this video: https://www.youtube.com/watch?v=UNDIrIyvQFk even though I succesfully logged in through CLI.

youtube-dl -n https://www.youtube.com/watch?v=UNDIrIyvQFk
[youtube] Downloading login page
[youtube] Logging in
Type 2-step verification code and press [Return]: 
[youtube] Submitting TFA code
[youtube] UNDIrIyvQFk: Downloading webpage
[youtube] UNDIrIyvQFk: Downloading embed webpage
[youtube] UNDIrIyvQFk: Refetching age-gated info webpage
ERROR: UNDIrIyvQFk: YouTube said: Watch this video on YouTube.
Playback on other websites has been disabled by the video owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.