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

Twitch VODs fail with parsing of the thumbnail data #25531

Closed
Salz opened this issue Jun 5, 2020 · 2 comments
Closed

Twitch VODs fail with parsing of the thumbnail data #25531

Salz opened this issue Jun 5, 2020 · 2 comments

Comments

@Salz
Copy link

@Salz Salz commented Jun 5, 2020

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running youtube-dl version 2020.05.29
    I also have applied the diff from by previous bug #25528, otherwise I would getthe 410 error.
  • I've checked that all provided URLs are alive and playable in a browser
    I have my browser configured to not play videos, but the videos are alive and the attached patch fixes playback of the videos.
  • 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: ['--verbose', 'https://www.twitch.tv/videos/640872506']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.05.29
[debug] Python version 3.8.3 (CPython) - Linux-5.6.9-pinguin20200502-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg 4.2.2-1, ffprobe 4.2.2-1, rtmpdump 2.4
[debug] Proxy map: {}
[twitch:vod] 640872506: Downloading vod info JSON
[twitch:vod] 640872506: Downloading vod access token
[twitch:vod] 640872506: Downloading m3u8 information
Traceback (most recent call last):
File "/usr/bin/youtube-dl", line 11, in
load_entry_point('youtube-dl==2020.5.29', 'console_scripts', 'youtube-dl')()
File "/usr/lib/python3/dist-packages/youtube_dl/init.py", line 478, in main
_real_main(argv)
File "/usr/lib/python3/dist-packages/youtube_dl/init.py", line 468, in _real_main
retcode = ydl.download(all_urls)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 2018, in download
res = self.extract_info(
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 808, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 863, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 1460, in process_video_result
t['url'] = sanitize_url(t['url'])
File "/usr/lib/python3/dist-packages/youtube_dl/utils.py", line 2135, in sanitize_url
if url.startswith('//'):
AttributeError: 'dict' object has no attribute 'startswith'

Description

It seems Twitch is returning a dictionary of several thumbnails now with info.get('preview') (extractor/twitch.py line 194). On the above URL i get the following json data:

{"small": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/dfa4f0f421b0286b0cb0_rahmschnitzel_1840886609_115117682//thumb/thumb0-80x45.jpg",
 "medium": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/dfa4f0f421b0286b0cb0_rahmschnitzel_1840886609_115117682//thumb/thumb0-320x180.jpg",
 "large": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/dfa4f0f421b0286b0cb0_rahmschnitzel_1840886609_115117682//thumb/thumb0-640x360.jpg",
 "template": "https://static-cdn.jtvnw.net/cf_vods/d2nvs31859zcd8/dfa4f0f421b0286b0cb0_rahmschnitzel_1840886609_115117682//thumb/thumb0-{width}x{height}.jpg"}

Parsing of the thumbnail(s) only supports a string or an array of dictionaries. Arbitrarily selecting one seems to work (see attached patch), otherwise the preview data must be reparsed into the expected format for "thumbnails".

thumbnail.diff.txt

@FREEZEball
Copy link

@FREEZEball FREEZEball commented Jun 5, 2020

Can confirm the same issue, fixed with the applied patch.

@seboss666
Copy link

@seboss666 seboss666 commented Jun 5, 2020

Thanks for this quick patch, hope to see it in the next release :)

@dstftw dstftw closed this in a0455d0 Jun 5, 2020
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
3 participants
You can’t perform that action at this time.