1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-23 09:17:48 +00:00

Merge branch 'viki-shows' of https://github.com/ping/youtube-dl into ping-viki-shows

This commit is contained in:
Sergey M․ 2015-05-20 20:17:47 +06:00
commit cc7051efd7
2 changed files with 8 additions and 5 deletions

View file

@ -645,7 +645,7 @@ from .vine import (
) )
from .viki import ( from .viki import (
VikiIE, VikiIE,
VikiShowIE, VikiChannelIE,
) )
from .vk import ( from .vk import (
VKIE, VKIE,

View file

@ -147,8 +147,8 @@ class VikiIE(InfoExtractor):
return res return res
class VikiShowIE(InfoExtractor): class VikiChannelIE(InfoExtractor):
IE_NAME = 'viki:show' IE_NAME = 'viki:channel'
_VALID_URL = r'^https?://(?:www\.)?viki\.com/tv/(?P<id>[0-9]+c)' _VALID_URL = r'^https?://(?:www\.)?viki\.com/tv/(?P<id>[0-9]+c)'
_TESTS = [{ _TESTS = [{
'url': 'http://www.viki.com/tv/50c-boys-over-flowers', 'url': 'http://www.viki.com/tv/50c-boys-over-flowers',
@ -167,6 +167,7 @@ class VikiShowIE(InfoExtractor):
}, },
'playlist_count': 127, 'playlist_count': 127,
}] }]
_PER_PAGE = 25
def _real_extract(self, url): def _real_extract(self, url):
show_id = self._match_id(url) show_id = self._match_id(url)
@ -177,10 +178,12 @@ class VikiShowIE(InfoExtractor):
entries = [] entries = []
for video_type in ['episodes', 'clips']: 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: while json_url is not None:
show_json = self._download_json( 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']: for video in show_json['response']:
video_id = video['id'] video_id = video['id']
entries.append(self.url_result( entries.append(self.url_result(