diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-05-20 20:17:47 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-05-20 20:17:47 +0600 |
commit | cc7051efd798691773164fc08f4286ff4c0ab317 (patch) | |
tree | f361a2466108e8c77614229de78ab68c9c3673b6 /youtube_dl | |
parent | adb6b1b3161d5a2d3478657904d1fb4f564cd366 (diff) | |
parent | 8da0e0e94682faa0463f33d991df70a2402b5a86 (diff) |
Merge branch 'viki-shows' of https://github.com/ping/youtube-dl into ping-viki-shows
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 2 | ||||
-rw-r--r-- | youtube_dl/extractor/viki.py | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 8c28cdc71..173e9a155 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -645,7 +645,7 @@ from .vine import ( ) from .viki import ( VikiIE, - VikiShowIE, + VikiChannelIE, ) from .vk import ( VKIE, diff --git a/youtube_dl/extractor/viki.py b/youtube_dl/extractor/viki.py index 4d477b03c..9bdbdc3e4 100644 --- a/youtube_dl/extractor/viki.py +++ b/youtube_dl/extractor/viki.py @@ -147,8 +147,8 @@ class VikiIE(InfoExtractor): return res -class VikiShowIE(InfoExtractor): - IE_NAME = 'viki:show' +class VikiChannelIE(InfoExtractor): + IE_NAME = 'viki:channel' _VALID_URL = r'^https?://(?:www\.)?viki\.com/tv/(?P<id>[0-9]+c)' _TESTS = [{ 'url': 'http://www.viki.com/tv/50c-boys-over-flowers', @@ -167,6 +167,7 @@ class VikiShowIE(InfoExtractor): }, 'playlist_count': 127, }] + _PER_PAGE = 25 def _real_extract(self, url): show_id = self._match_id(url) @@ -177,10 +178,12 @@ class VikiShowIE(InfoExtractor): entries = [] for video_type in ['episodes', 'clips']: - json_url = 'http://api.viki.io/v4/containers/%s/%s.json?app=100000a&per_page=25&sort=number&direction=asc&with_paging=true&page=1' % (show_id, video_type) + json_url = 'http://api.viki.io/v4/containers/%s/%s.json?app=100000a&per_page=%d&sort=number&direction=asc&with_paging=true&page=1' % (show_id, video_type, self._PER_PAGE) while json_url is not None: show_json = self._download_json( - json_url, show_id, note='Retrieve show json', errnote='Unable to get show json') + json_url, show_id, + note='Downloading %s json page #%s' % + (video_type, re.search(r'[?&]page=([0-9]+)', json_url).group(1))) for video in show_json['response']: video_id = video['id'] entries.append(self.url_result( |