mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	@@ -255,15 +255,8 @@ class VikiIE(VikiBaseIE):
 | 
				
			|||||||
    def _real_extract(self, url):
 | 
					    def _real_extract(self, url):
 | 
				
			||||||
        video_id = self._match_id(url)
 | 
					        video_id = self._match_id(url)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        resp = self._download_json(
 | 
					        video = self._call_api(
 | 
				
			||||||
            'https://www.viki.com/api/videos/' + video_id,
 | 
					            'videos/%s.json' % video_id, video_id, 'Downloading video JSON')
 | 
				
			||||||
            video_id, 'Downloading video JSON', headers={
 | 
					 | 
				
			||||||
                'x-client-user-agent': std_headers['User-Agent'],
 | 
					 | 
				
			||||||
                'x-viki-as-id': self._APP,
 | 
					 | 
				
			||||||
                'x-viki-app-ver': self._APP_VERSION,
 | 
					 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
        video = resp['video']
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self._check_errors(video)
 | 
					        self._check_errors(video)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        title = self.dict_selection(video.get('titles', {}), 'en', allow_fallback=False)
 | 
					        title = self.dict_selection(video.get('titles', {}), 'en', allow_fallback=False)
 | 
				
			||||||
@@ -286,24 +279,6 @@ class VikiIE(VikiBaseIE):
 | 
				
			|||||||
            })
 | 
					            })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        subtitles = {}
 | 
					        subtitles = {}
 | 
				
			||||||
        try:
 | 
					 | 
				
			||||||
            # New way to fetch subtitles
 | 
					 | 
				
			||||||
            new_video = self._download_json(
 | 
					 | 
				
			||||||
                'https://www.viki.com/api/videos/%s' % video_id, video_id,
 | 
					 | 
				
			||||||
                'Downloading new video JSON to get subtitles', fatal=False,
 | 
					 | 
				
			||||||
                headers={
 | 
					 | 
				
			||||||
                    'x-client-user-agent': std_headers['User-Agent'],
 | 
					 | 
				
			||||||
                    'x-viki-as-id': self._APP,
 | 
					 | 
				
			||||||
                    'x-viki-app-ver': self._APP_VERSION,
 | 
					 | 
				
			||||||
                })
 | 
					 | 
				
			||||||
            for sub in new_video.get('streamSubtitles').get('dash'):
 | 
					 | 
				
			||||||
                subtitles[sub.get('srclang')] = [{
 | 
					 | 
				
			||||||
                    'ext': 'vtt',
 | 
					 | 
				
			||||||
                    'url': sub.get('src'),
 | 
					 | 
				
			||||||
                    'completion': sub.get('percentage'),
 | 
					 | 
				
			||||||
                }]
 | 
					 | 
				
			||||||
        except AttributeError:
 | 
					 | 
				
			||||||
            # fall-back to the old way if there isn't a streamSubtitles attribute
 | 
					 | 
				
			||||||
        for subtitle_lang, _ in (video.get('subtitle_completions') or {}).items():
 | 
					        for subtitle_lang, _ in (video.get('subtitle_completions') or {}).items():
 | 
				
			||||||
            subtitles[subtitle_lang] = [{
 | 
					            subtitles[subtitle_lang] = [{
 | 
				
			||||||
                'ext': subtitles_format,
 | 
					                'ext': subtitles_format,
 | 
				
			||||||
@@ -386,9 +361,6 @@ class VikiIE(VikiBaseIE):
 | 
				
			|||||||
                    'filesize': int_or_none(urlh.headers.get('Content-Length')),
 | 
					                    'filesize': int_or_none(urlh.headers.get('Content-Length')),
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for format_id, format_dict in (resp.get('streams') or {}).items():
 | 
					 | 
				
			||||||
            add_format(format_id, format_dict)
 | 
					 | 
				
			||||||
        if not formats:
 | 
					 | 
				
			||||||
        streams = self._call_api(
 | 
					        streams = self._call_api(
 | 
				
			||||||
            'videos/%s/streams.json' % video_id, video_id,
 | 
					            'videos/%s/streams.json' % video_id, video_id,
 | 
				
			||||||
            'Downloading video streams JSON')
 | 
					            'Downloading video streams JSON')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user