[rutube] Simplify

pull/2255/merge
Philipp Hagemeister 2014-01-28 03:32:07 +01:00
parent 4857beba3a
commit 37e3b90d59
1 changed files with 14 additions and 12 deletions

View File

@ -76,15 +76,16 @@ class RutubeChannelIE(InfoExtractor):
def _extract_videos(self, channel_id, channel_title=None):
entries = []
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)
page = json.loads(api_response)
results = page['results']
if len(results) == 0:
break;
if not results:
break
entries.extend(self.url_result(result['video_url'], 'Rutube') for result in results)
if page['has_next'] is False:
break;
if not page['has_next']:
break
return self.playlist_result(entries, channel_id, channel_title)
def _real_extract(self, url):
@ -104,7 +105,8 @@ class RutubeMovieIE(RutubeChannelIE):
def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url)
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')
movie = json.loads(api_response)
movie_name = movie['name']