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

youtube.com "ERROR: Content Warning" #16445

Closed
5 of 9 tasks
nyaasi opened this issue May 13, 2018 · 11 comments
Closed
5 of 9 tasks

youtube.com "ERROR: Content Warning" #16445

nyaasi opened this issue May 13, 2018 · 11 comments

Comments

@nyaasi
Copy link

nyaasi commented May 13, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.05.09. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.05.09

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--username', u'PRIVATE', u'--password', u'PRIVATE', u'https://www.youtube.com/watch?v=wSFvZUK4xWU']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.05.09
[debug] Python version 2.7.9 (CPython) - Linux-4.14.9-041409-generic-x86_64-with-Ubuntu-15.04-vivid
[debug] exe versions: ffmpeg 2.5.10-0ubuntu0.15.04.1, ffprobe 2.5.10-0ubuntu0.15.04.1, phantomjs 1.9.0
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
[youtube] Logging in
[youtube] Checking cookie
[youtube] wSFvZUK4xWU: Downloading webpage
[youtube] wSFvZUK4xWU: Downloading embed webpage
[youtube] wSFvZUK4xWU: Refetching age-gated info webpage
[youtube] wSFvZUK4xWU: Extracting video information
ERROR: Content Warning
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 792, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 503, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/bin/youtube-dl/youtube_dl/extractor/youtube.py", line 1974, in _real_extract
    raise ExtractorError(unavailable_message, expected=True)
ExtractorError: Content Warning

<end of log>

Description of your issue, suggested solution and other information

While downloading age-gated content, one of the videos (see output) fails with "ERROR: Content Warning".
Tested it while passing the login credentials and cookies. Any other age-gated content works, except this one.

@dstftw
Copy link
Collaborator

dstftw commented May 13, 2018

You did not pass credentials to youtube-dl.

@dstftw dstftw closed this as completed May 13, 2018
@dstftw dstftw added the invalid label May 13, 2018
@dstftw dstftw reopened this May 13, 2018
@vovavvk
Copy link

vovavvk commented Jun 5, 2019

@dstftw there you go

youtube-dl.exe -i --no-playlist -R 100 --fragment-retries 100 -c -w -F https://youtu.be/5wHbTXgy0M4

@EndlessNull
Copy link

youtube-dl -F -v https://www.youtube.com/watch?v=zAa6CS6ALhM

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2019.07.14
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar bug reports including closed ones
  • I've read bugs section in FAQ

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-F', '-v', 'https://www.youtube.com/watch?v=zAa6CS6ALhM']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2019.07.14
[debug] Python version 3.6.8 (CPython) - Linux-4.15.0-20-generic-x86_64-with-LinuxMint-19.1-tessa
[debug] exe versions: ffmpeg 3.4.6, ffprobe 3.4.6
[debug] Proxy map: {}
[youtube] zAa6CS6ALhM: Downloading webpage
[youtube] zAa6CS6ALhM: Downloading embed webpage
[youtube] zAa6CS6ALhM: Refetching age-gated info webpage
ERROR: Content Warning
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/common.py", line 530, in extract
    ie_result = self._real_extract(url)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/extractor/youtube.py", line 2109, in _real_extract
    raise ExtractorError(error_message, expected=True)
youtube_dl.utils.ExtractorError: Content Warning

Description

Same question, other age-gated content works, except this one.

@glenn-slayden
Copy link
Contributor

This is a case of reporting a misleading status message. The error message it shows in this case is actually a warning, and not a fatal error, but it's from beyond the age-gate page. And it turns out that there's a more pressing failure, so the inability to download is real.

The true error, which youtube-dl should probably report instead. is likely:

Watch this video on YouTube. Playback on other websites has been disabled by the video owner.

The problem is that the age_gate code path doesn't check for such error messages. Instead the operation fails later upon discovering that there is no actual video url (or dash manifest) to download. In other words, the error message you're getting is actually just the warning that would apply if you did "watch this video on YouTube."

To fix the error message, insert the following three lines into extractor/youtube.py:

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)
pl_response = video_info.get('player_response', [None])[0]
player_response = extract_player_response(pl_response, video_id)

    +     player_status = player_response.get('playabilityStatus')
    +     if 'reason' in player_status:
    +         raise ExtractorError(clean_html(player_status['reason']), expected=True)

add_dash_mpd(video_info)
view_count = extract_view_count(video_info)

cc: @dstftw

@glenn-slayden
Copy link
Contributor

glenn-slayden commented Jul 30, 2019

Actually, it turns out that those three lines are applicable to the non-age-gated code path as well. So it would be even better to insert them here instead:

   +     player_status = player_response.get('playabilityStatus')
   +     if 'reason' in player_status:
   +         raise ExtractorError(clean_html(player_status['reason']), expected=True)

def extract_unavailable_message():
return self._html_search_regex(
r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
video_webpage, 'unavailable message', default=None)

@glenn-slayden
Copy link
Contributor

glenn-slayden commented Aug 5, 2019

ping @dstftw -- this is an easy 3-line fix if you want to adopt it...

Besides giving a more correct error message for age-gate failures, this change also makes youtube-dl abandon those cases earlier on, which avoids further wasted effort extracting metadata.

@dstftw
Copy link
Collaborator

dstftw commented Aug 5, 2019

Watch this video on YouTube. Playback on other websites has been disabled by the video owner.

is as useless and incorrect as the current one.

The real error in my case is

Sign in to confirm your age
This video may be inappropriate for some users. Confirm and download?

@glenn-slayden
Copy link
Contributor

Thanks. That's why you're the expert.

@diamondsw
Copy link

Before I post what may be a duplicate, is it expected behavior now that certain age-gated videos cannot be downloaded without logging in? I thought previously youtube-dl had ways of bypassing such checks.

@rebane2001
Copy link

@diamondsw Youtube-dl bypasses it by doing (this is my assumption) /embed/
This means that if the video does not allow playback on other websites, it won't be downloaded and you HAVE to sign in

@salamihawk
Copy link

Despite the commit on Aug 5, this issue still persists.

I'm calling Youtube-DL via an import into a script of my own. I'm setting login data and passing it to youtube-dl. This appears to work fine for most videos, but age-gated videos with embeds disabled refuse to work.

Tests by calling youtube-dl directly from the command line are also unsuccessful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants