mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 17:02:30 +00:00
[rutube] Simplify
This commit is contained in:
parent
4857beba3a
commit
37e3b90d59
@ -76,15 +76,16 @@ class RutubeChannelIE(InfoExtractor):
|
|||||||
def _extract_videos(self, channel_id, channel_title=None):
|
def _extract_videos(self, channel_id, channel_title=None):
|
||||||
entries = []
|
entries = []
|
||||||
for pagenum in itertools.count(1):
|
for pagenum in itertools.count(1):
|
||||||
api_response = self._download_webpage(self._PAGE_TEMPLATE % (channel_id, pagenum),
|
api_response = self._download_webpage(
|
||||||
|
self._PAGE_TEMPLATE % (channel_id, pagenum),
|
||||||
channel_id, 'Downloading page %s' % pagenum)
|
channel_id, 'Downloading page %s' % pagenum)
|
||||||
page = json.loads(api_response)
|
page = json.loads(api_response)
|
||||||
results = page['results']
|
results = page['results']
|
||||||
if len(results) == 0:
|
if not results:
|
||||||
break;
|
break
|
||||||
entries.extend(self.url_result(result['video_url'], 'Rutube') for result in results)
|
entries.extend(self.url_result(result['video_url'], 'Rutube') for result in results)
|
||||||
if page['has_next'] is False:
|
if not page['has_next']:
|
||||||
break;
|
break
|
||||||
return self.playlist_result(entries, channel_id, channel_title)
|
return self.playlist_result(entries, channel_id, channel_title)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -104,7 +105,8 @@ class RutubeMovieIE(RutubeChannelIE):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
movie_id = mobj.group('id')
|
movie_id = mobj.group('id')
|
||||||
api_response = self._download_webpage(self._MOVIE_TEMPLATE % movie_id, movie_id,
|
api_response = self._download_webpage(
|
||||||
|
self._MOVIE_TEMPLATE % movie_id, movie_id,
|
||||||
'Downloading movie JSON')
|
'Downloading movie JSON')
|
||||||
movie = json.loads(api_response)
|
movie = json.loads(api_response)
|
||||||
movie_name = movie['name']
|
movie_name = movie['name']
|
||||||
|
Loading…
Reference in New Issue
Block a user