X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fivi.py;h=472d72b4c34fa3305b6b2808be1e45c6da25a60e;hb=dfb1b1468cef4ddc7ecc43776abce03763f8e426;hp=216c534b5ea10dfd85005ecf71823566694fbb26;hpb=ab3176af3472917537635bd96b860a974094b0af;p=youtube-dl diff --git a/youtube_dl/extractor/ivi.py b/youtube_dl/extractor/ivi.py index 216c534b5..472d72b4c 100644 --- a/youtube_dl/extractor/ivi.py +++ b/youtube_dl/extractor/ivi.py @@ -32,7 +32,7 @@ class IviIE(InfoExtractor): }, 'skip': 'Only works from Russia', }, - # Serial's serie + # Serial's series { 'url': 'http://www.ivi.ru/watch/dvoe_iz_lartsa/9549', 'md5': '221f56b35e3ed815fde2df71032f4b3e', @@ -41,6 +41,8 @@ class IviIE(InfoExtractor): 'ext': 'mp4', 'title': 'Двое из ларца - Дело Гольдберга (1 часть)', 'series': 'Двое из ларца', + 'season': 'Сезон 1', + 'season_number': 1, 'episode': 'Дело Гольдберга (1 часть)', 'episode_number': 1, 'duration': 2655, @@ -105,6 +107,13 @@ class IviIE(InfoExtractor): webpage = self._download_webpage(url, video_id) + season = self._search_regex( + r']+class="season active"[^>]*>]+>([^<]+)', + webpage, 'season', default=None) + season_number = int_or_none(self._search_regex( + r']+class="season active"[^>]*>]+data-season(?:-index)?="(\d+)"', + webpage, 'season number', default=None)) + episode_number = int_or_none(self._search_regex( r']+itemprop="episode"[^>]*>\s*]+itemprop="episodeNumber"[^>]+content="(\d+)', webpage, 'episode number', default=None)) @@ -116,6 +125,8 @@ class IviIE(InfoExtractor): 'id': video_id, 'title': title, 'series': compilation, + 'season': season, + 'season_number': season_number, 'episode': episode, 'episode_number': episode_number, 'thumbnails': thumbnails, @@ -146,8 +157,11 @@ class IviCompilationIE(InfoExtractor): }] def _extract_entries(self, html, compilation_id): - return [self.url_result('http://www.ivi.ru/watch/%s/%s' % (compilation_id, serie), 'Ivi') - for serie in re.findall(r'(?:[^<]+)' % compilation_id, html)] + return [ + self.url_result( + 'http://www.ivi.ru/watch/%s/%s' % (compilation_id, serie), IviIE.ie_key()) + for serie in re.findall( + r']+data-id="\1"' % compilation_id, html)] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) @@ -155,7 +169,8 @@ class IviCompilationIE(InfoExtractor): season_id = mobj.group('seasonid') if season_id is not None: # Season link - season_page = self._download_webpage(url, compilation_id, 'Downloading season %s web page' % season_id) + season_page = self._download_webpage( + url, compilation_id, 'Downloading season %s web page' % season_id) playlist_id = '%s/season%s' % (compilation_id, season_id) playlist_title = self._html_search_meta('title', season_page, 'title') entries = self._extract_entries(season_page, compilation_id) @@ -163,8 +178,9 @@ class IviCompilationIE(InfoExtractor): compilation_page = self._download_webpage(url, compilation_id, 'Downloading compilation web page') playlist_id = compilation_id playlist_title = self._html_search_meta('title', compilation_page, 'title') - seasons = re.findall(r'[^<]+' % compilation_id, compilation_page) - if len(seasons) == 0: # No seasons in this compilation + seasons = re.findall( + r'