aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/viki.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/extractor/viki.py')
-rw-r--r--hypervideo_dl/extractor/viki.py30
1 files changed, 7 insertions, 23 deletions
diff --git a/hypervideo_dl/extractor/viki.py b/hypervideo_dl/extractor/viki.py
index acb5ae5..8a93079 100644
--- a/hypervideo_dl/extractor/viki.py
+++ b/hypervideo_dl/extractor/viki.py
@@ -19,7 +19,7 @@ class VikiBaseIE(InfoExtractor):
_VALID_URL_BASE = r'https?://(?:www\.)?viki\.(?:com|net|mx|jp|fr)/'
_API_URL_TEMPLATE = 'https://api.viki.io%s'
- _DEVICE_ID = '86085977d' # used for android api
+ _DEVICE_ID = '112395910d'
_APP = '100005a'
_APP_VERSION = '6.11.3'
_APP_SECRET = 'd96704b180208dbb2efa30fe44c48bd8690441af9f567ba8fd710a72badc85198f7472'
@@ -99,14 +99,7 @@ class VikiBaseIE(InfoExtractor):
self.raise_login_required(message)
self._raise_error(message)
- def _real_initialize(self):
- self._login()
-
- def _login(self):
- username, password = self._get_login_info()
- if username is None:
- return
-
+ def _perform_login(self, username, password):
self._token = self._call_api(
'sessions.json', None, 'Logging in', fatal=False,
data={'username': username, 'password': password}).get('token')
@@ -135,9 +128,6 @@ class VikiIE(VikiBaseIE):
'uploader': 'FCC',
'upload_date': '20201127',
},
- 'params': {
- 'format': 'bestvideo',
- },
}, {
'url': 'http://www.viki.com/videos/1023585v-heirs-episode-14',
'info_dict': {
@@ -151,9 +141,6 @@ class VikiIE(VikiBaseIE):
'duration': 3570,
'episode_number': 14,
},
- 'params': {
- 'format': 'bestvideo',
- },
'skip': 'Blocked in the US',
}, {
# clip
@@ -203,9 +190,6 @@ class VikiIE(VikiBaseIE):
'age_limit': 13,
'episode_number': 1,
},
- 'params': {
- 'format': 'bestvideo',
- },
}, {
# youtube external
'url': 'http://www.viki.com/videos/50562v-poor-nastya-complete-episode-1',
@@ -241,9 +225,6 @@ class VikiIE(VikiBaseIE):
'title': 'Love In Magic',
'age_limit': 13,
},
- 'params': {
- 'format': 'bestvideo',
- },
}]
def _real_extract(self, url):
@@ -265,7 +246,7 @@ class VikiIE(VikiBaseIE):
} for thumbnail_id, thumbnail in (video.get('images') or {}).items() if thumbnail.get('url')]
resp = self._call_api(
- 'playback_streams/%s.json?drms=dt1,dt2&device_id=%s' % (video_id, self._DEVICE_ID),
+ 'playback_streams/%s.json?drms=dt3&device_id=%s' % (video_id, self._DEVICE_ID),
video_id, 'Downloading video streams JSON')['main'][0]
stream_id = try_get(resp, lambda x: x['properties']['track']['stream_id'])
@@ -276,10 +257,13 @@ class VikiIE(VikiBaseIE):
} for ext in ('srt', 'vtt')]) for lang in (video.get('subtitle_completions') or {}).keys())
mpd_url = resp['url']
- # 1080p is hidden in another mpd which can be found in the current manifest content
+ # 720p is hidden in another MPD which can be found in the current manifest content
mpd_content = self._download_webpage(mpd_url, video_id, note='Downloading initial MPD manifest')
mpd_url = self._search_regex(
r'(?mi)<BaseURL>(http.+.mpd)', mpd_content, 'new manifest', default=mpd_url)
+ if 'mpdhd_high' not in mpd_url and 'sig=' not in mpd_url:
+ # Modify the URL to get 1080p
+ mpd_url = mpd_url.replace('mpdhd', 'mpdhd_high')
formats = self._extract_mpd_formats(mpd_url, video_id)
self._sort_formats(formats)