1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 13:50:02 +08:00

[televizeseznam] handle possible redirects

Co-Authored-By: Ales Jirasek <6615474+schunka@users.noreply.github.com>
This commit is contained in:
Petr Vaněk 2020-01-14 18:38:11 +01:00 committed by Petr Vaněk
parent 6dcd00474a
commit e021db8db6

View File

@ -75,8 +75,13 @@ class TelevizeSeznamIE(InfoExtractor):
headers={'Content-Type': 'application/json;charset=UTF-8'}
)['data']
spl_url = data['episode']['spl']
play_list = self._download_json(spl_url + 'spl2,3', video_id, 'Downloading playlist')['data']
spl_url = data['episode']['spl'] + 'spl2,3'
metadata = self._download_json(spl_url, video_id, 'Downloading playlist')
if 'Location' in metadata and 'data' not in metadata:
# they sometimes wants to redirect
spl_url = metadata['Location']
metadata = self._download_json(spl_url, video_id, 'Redirected -> Downloading playlist')
play_list = metadata['data']
subtitles = self.extract_subtitles(spl_url, play_list.get('subtitles'))
formats = self.extract_formats(spl_url, play_list['mp4'], subtitles)