youtube-dl: Unable to download from ITV Hub
Checklist
- I’ve verified that I’m running youtube-dl version 2021.12.17
- 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: [u'--verbose', u'https://www.itv.com/hub/celebrity-juice/1a7045a0288']
[debug] Encodings: locale UTF-8, fs UTF-8, out None, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Python version 2.7.18 (CPython) - Linux-5.4.0-96-generic-x86_64-with-Ubuntu-20.04-focal
[debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, phantomjs ., rtmpdump 2.4
[debug] Proxy map: {'no': 'localhost,127.0.0.1,::1'}
[debug] Using fake IP 25.170.173.6 (GB) as X-Forwarded-For.
[ITV] 1a7045a0288: Downloading webpage
ERROR: Unable to download webpage: ('The read operation timed out',) (caused by SSLError('The read operation timed out',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type youtube-dl -U to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
File "/usr/local/bin/youtube-dl/youtube_dl/extractor/common.py", line 634, in _request_webpage
return self._downloader.urlopen(url_or_request)
File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 2288, in urlopen
return self._opener.open(req, timeout=self._socket_timeout)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
result = func(*args)
File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 2737, in https_open
req, **kwargs)
File "/usr/lib/python2.7/urllib2.py", line 1208, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib/python2.7/httplib.py", line 1178, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 452, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 408, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib/python2.7/socket.py", line 480, in readline
data = self._sock.recv(self._rbufsize)
File "/usr/lib/python2.7/ssl.py", line 754, in recv
return self.read(buflen)
File "/usr/lib/python2.7/ssl.py", line 641, in read
v = self._sslobj.read(len)
Description
Trying to download episodes of Celebrity Juice from the ITV Hub, but it’s halting after ‘Downloading webpage’ and then several minutes later it errors out.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (6 by maintainers)
I performed some additional tests with
youtube-dl.exeand it looks like Chrome/89 is the minimum Chrome version (at this time 😉 …) thatwww.itv.comwill sanction when requested byyt-dl:exhibits the issue reported by OP, while
successfully gets past the
[ITV] 1a7045a0288: Downloading webpagestage and on to[ITV] 1a7045a0288: Downloading JSON metadata; actually, setting the Chrome version to a big, future, value also does the trick (e.g.--user-agent "Chrome/200"); JFYI… 😃I’m not completely au fait with the filesystem of a Mac, but the file you’re after can be found on the ‘Files changed’ tab of #30266 - here’s a link to the raw file; https://raw.githubusercontent.com/ytdl-org/youtube-dl/0945174fa4326d5bd4b04d2b6f5ed104569c5559/youtube_dl/extractor/itv.py
You’ll need to find out where the
/youtube_dl/extractor/folder is on your machine, and download the file overwriting the existing version. Probably best to take a copy of the original before you alter it. You’ll probably be able to see the path somewhere in the output if you add the--verboseswitch when you run the command.Hope that helps.
Perfect - installed that version of itv.py and it worked a treat - thank you
Today, using #30266 and
--user-agent 'Chrome/89':OT TV critic: see how I used the
--testoption to avoid getting a viewable version of the show itself! The selection of Plebs and Wossie as test shows in the extractor was more acceptable.Apologies but I don’t fully understand the above - should this be working now using --user-agent “Chrome/89” ?
When using the example above, I get ERROR: Unable to download JSON metadata: HTTP Error 404: Not Found (caused by <HTTPError 404: ‘Not Found’>);
I am running youtube-dl version 2021.12.17
The betting is that ITV has employed a bouncer that rejects or ignores your web requests if it doesn’t like the look of them.
For the moment,
--user-agent 'Mozilla/5.0'confuses the bouncer into allowing access, like some suede trainers.In your log, yt-dl sent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.73 Safari/537.36as if it was Chrome 70 on Windows 10 64-bit, but perhaps the bouncer only accepts that UA with HTTP/2 (Chrome 51 on).@Vangelis66 - fixed - nice spot 😉
Have you tried the
--hls-prefer-nativeswitch?youtube-dldefaults to usingffmpegfor dumping AES-128 encrypted HLS streams (it’s the type of mobile streams the ITV Info Extractor “harvests” in order to fetch the ITVHub programme 😜 ), but said switch will dump the stream via a pure Python implementation, no external downloader needed… However, since this is on a Mac, you may have to install an additional “decrypting” python module (hlsnative dependency), such as the deprecated PyCrypro or the active PyCryprodome equivalent; consult some Mac documentation on how to install one of these modules… But, as your log shows,ffmpegis still required to mux downloaded stream to the MP4 container, so it’s a good thing you installed it anyway… 😃Yes; look at the formats tables posted by me here and by dirkf here (resolution column) …
Cheers 😄
… The link points to
https://github.com/ytdl-org/youtube-dl/issues/url😉 ; no doubt a mishap 😄 , but it should be fixed…I expect your current desktop browser is sending the slightly different HTTP headers.