Skip to content

Commit 1c6f480

Browse files
authored
[viki] Fix "Bad request" for manifest (yt-dlp#2540)
Closes yt-dlp#2499 Authored by: nyuszika7h
1 parent f8580bf commit 1c6f480

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

yt_dlp/extractor/viki.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class VikiBaseIE(InfoExtractor):
1919
_VALID_URL_BASE = r'https?://(?:www\.)?viki\.(?:com|net|mx|jp|fr)/'
2020
_API_URL_TEMPLATE = 'https://api.viki.io%s'
2121

22-
_DEVICE_ID = '86085977d' # used for android api
22+
_DEVICE_ID = '112395910d'
2323
_APP = '100005a'
2424
_APP_VERSION = '6.11.3'
2525
_APP_SECRET = 'd96704b180208dbb2efa30fe44c48bd8690441af9f567ba8fd710a72badc85198f7472'
@@ -253,7 +253,7 @@ def _real_extract(self, url):
253253
} for thumbnail_id, thumbnail in (video.get('images') or {}).items() if thumbnail.get('url')]
254254

255255
resp = self._call_api(
256-
'playback_streams/%s.json?drms=dt1,dt2&device_id=%s' % (video_id, self._DEVICE_ID),
256+
'playback_streams/%s.json?drms=dt3&device_id=%s' % (video_id, self._DEVICE_ID),
257257
video_id, 'Downloading video streams JSON')['main'][0]
258258

259259
stream_id = try_get(resp, lambda x: x['properties']['track']['stream_id'])
@@ -264,10 +264,13 @@ def _real_extract(self, url):
264264
} for ext in ('srt', 'vtt')]) for lang in (video.get('subtitle_completions') or {}).keys())
265265

266266
mpd_url = resp['url']
267-
# 1080p is hidden in another mpd which can be found in the current manifest content
267+
# 720p is hidden in another MPD which can be found in the current manifest content
268268
mpd_content = self._download_webpage(mpd_url, video_id, note='Downloading initial MPD manifest')
269269
mpd_url = self._search_regex(
270270
r'(?mi)<BaseURL>(http.+.mpd)', mpd_content, 'new manifest', default=mpd_url)
271+
if 'mpdhd_high' not in mpd_url:
272+
# Modify the URL to get 1080p
273+
mpd_url = mpd_url.replace('mpdhd', 'mpdhd_high')
271274
formats = self._extract_mpd_formats(mpd_url, video_id)
272275
self._sort_formats(formats)
273276

0 commit comments

Comments
 (0)