youtube-dl: ARDMediathek HTTP Error 412: Precondition Failed for some videos
Checklist
- I’m reporting a broken site support
- I’ve verified that I’m running youtube-dl version 2021.04.26
- 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 issues including closed ones
Verbose log
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ignore-config', '-v', 'https://ardmediathek.de/video/feuer-und-flamme/feuer-und-flamme-s01-e01/wdr-fernsehen/Y3JpZDovL3dkci5kZS9CZWl0cmFnLTM1Y2IwM2VkLTNkOTgtNDBkZC1iZjIxLTU1ZjFjODE4MmFlNw/']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.04.26
[debug] Python version 3.9.4 (CPython) - Linux-5.12.0-1-MANJARO-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.3.2, ffprobe 4.3.2, rtmpdump 2.4
[debug] Proxy map: {}
[debug] Using fake IP 53.50.219.112 (DE) as X-Forwarded-For.
[ARDBetaMediathek] Y3JpZDovL3dkci5kZS9CZWl0cmFnLTM1Y2IwM2VkLTNkOTgtNDBkZC1iZjIxLTU1ZjFjODE4MmFlNw: Downloading JSON metadata
ERROR: Unable to download JSON metadata: HTTP Error 412: Precondition Failed (caused by <HTTPError 412: 'Precondition Failed'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see https://yt-dl.org/update on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
File "/usr/lib/python3.9/site-packages/youtube_dl/extractor/common.py", line 634, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 2279, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python3.9/urllib/request.py", line 523, in open
response = meth(req, response)
File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
response = self.parent.error(
File "/usr/lib/python3.9/urllib/request.py", line 561, in error
return self._call_chain(*args)
File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
Description
Youtube-dl fails for some videos of the ARDMediathek. An example video is https://ardmediathek.de/video/feuer-und-flamme/feuer-und-flamme-s01-e01/wdr-fernsehen/Y3JpZDovL3dkci5kZS9CZWl0cmFnLTM1Y2IwM2VkLTNkOTgtNDBkZC1iZjIxLTU1ZjFjODE4MmFlNw/
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15
This issue is caused by the
player_page
graphql query ( https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/extractor/ard.py#L379 ). Removing thetracking
block from the query appears to fix the issue in my local testing:I don’t know if this fix works for all videos that have this issue, or why it works, so I am not going to PR this.
definetly a problem depending on your own IP or provider. Just checked the exactly same download from two different systems with two different providers. one gives the error (deutsche telekom) , the other (versatel) runs fine. (for ONE time only. then the download fails exactly the same way, so maybe just try the download twice fore reproducing) So that geoblocking somehow seems to be the problem. If that @yawkat workaround works with everything it should be implemented for all the others and published, please.
@dstftw , please reopen this issue as it appears to be affecting multiple users (including myself on https://www.ardmediathek.de/video/feuer-und-flamme/schwerer-verkehrsunfall-oder-mit-gifttieren-ueben-fuer-den-ernstfall-s04-e02/wdr-fernsehen/Y3JpZDovL3dkci5kZS9CZWl0cmFnLWViOTVkN2ExLTY4ODctNDIwMy1iYjMwLTY1MDU1NTljYmYyZg/)
And I can confirm that @yawkat fix solves the issue for the above video.
I can confirm that @yawkat 's fix works also for https://www.ardmediathek.de/video/Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhdG9ydC8wNTQxYTQwZS1iNzcxLTRhYmYtYWUzYi02MDRhOTdlMDkzOTk/ , which failed before. Please reopen @dstftw , thanks!