You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

380 lines
13 KiB

11 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
Switch codebase to use sanitized_Request instead of compat_urllib_request.Request [downloader/dash] Use sanitized_Request [downloader/http] Use sanitized_Request [atresplayer] Use sanitized_Request [bambuser] Use sanitized_Request [bliptv] Use sanitized_Request [brightcove] Use sanitized_Request [cbs] Use sanitized_Request [ceskatelevize] Use sanitized_Request [collegerama] Use sanitized_Request [extractor/common] Use sanitized_Request [crunchyroll] Use sanitized_Request [dailymotion] Use sanitized_Request [dcn] Use sanitized_Request [dramafever] Use sanitized_Request [dumpert] Use sanitized_Request [eitb] Use sanitized_Request [escapist] Use sanitized_Request [everyonesmixtape] Use sanitized_Request [extremetube] Use sanitized_Request [facebook] Use sanitized_Request [fc2] Use sanitized_Request [flickr] Use sanitized_Request [4tube] Use sanitized_Request [gdcvault] Use sanitized_Request [extractor/generic] Use sanitized_Request [hearthisat] Use sanitized_Request [hotnewhiphop] Use sanitized_Request [hypem] Use sanitized_Request [iprima] Use sanitized_Request [ivi] Use sanitized_Request [keezmovies] Use sanitized_Request [letv] Use sanitized_Request [lynda] Use sanitized_Request [metacafe] Use sanitized_Request [minhateca] Use sanitized_Request [miomio] Use sanitized_Request [meovideo] Use sanitized_Request [mofosex] Use sanitized_Request [moniker] Use sanitized_Request [mooshare] Use sanitized_Request [movieclips] Use sanitized_Request [mtv] Use sanitized_Request [myvideo] Use sanitized_Request [neteasemusic] Use sanitized_Request [nfb] Use sanitized_Request [niconico] Use sanitized_Request [noco] Use sanitized_Request [nosvideo] Use sanitized_Request [novamov] Use sanitized_Request [nowness] Use sanitized_Request [nuvid] Use sanitized_Request [played] Use sanitized_Request [pluralsight] Use sanitized_Request [pornhub] Use sanitized_Request [pornotube] Use sanitized_Request [primesharetv] Use sanitized_Request [promptfile] Use sanitized_Request [qqmusic] Use sanitized_Request [rtve] Use sanitized_Request [safari] Use sanitized_Request [sandia] Use sanitized_Request [shared] Use sanitized_Request [sharesix] Use sanitized_Request [sina] Use sanitized_Request [smotri] Use sanitized_Request [sohu] Use sanitized_Request [spankwire] Use sanitized_Request [sportdeutschland] Use sanitized_Request [streamcloud] Use sanitized_Request [streamcz] Use sanitized_Request [tapely] Use sanitized_Request [tube8] Use sanitized_Request [tubitv] Use sanitized_Request [twitch] Use sanitized_Request [twitter] Use sanitized_Request [udemy] Use sanitized_Request [vbox7] Use sanitized_Request [veoh] Use sanitized_Request [vessel] Use sanitized_Request [vevo] Use sanitized_Request [viddler] Use sanitized_Request [videomega] Use sanitized_Request [viewvster] Use sanitized_Request [viki] Use sanitized_Request [vk] Use sanitized_Request [vodlocker] Use sanitized_Request [voicerepublic] Use sanitized_Request [wistia] Use sanitized_Request [xfileshare] Use sanitized_Request [xtube] Use sanitized_Request [xvideos] Use sanitized_Request [yandexmusic] Use sanitized_Request [youku] Use sanitized_Request [youporn] Use sanitized_Request [youtube] Use sanitized_Request [patreon] Use sanitized_Request [extractor/common] Remove unused import [nfb] PEP 8
9 years ago
11 years ago
11 years ago
11 years ago
10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. import hashlib
  4. import hmac
  5. import itertools
  6. import json
  7. import re
  8. import time
  9. from .common import InfoExtractor
  10. from ..utils import (
  11. ExtractorError,
  12. int_or_none,
  13. parse_age_limit,
  14. parse_iso8601,
  15. sanitized_Request,
  16. )
  17. class VikiBaseIE(InfoExtractor):
  18. _VALID_URL_BASE = r'https?://(?:www\.)?viki\.(?:com|net|mx|jp|fr)/'
  19. _API_QUERY_TEMPLATE = '/v4/%sapp=%s&t=%s&site=www.viki.com'
  20. _API_URL_TEMPLATE = 'http://api.viki.io%s&sig=%s'
  21. _APP = '65535a'
  22. _APP_VERSION = '2.2.5.1428709186'
  23. _APP_SECRET = '-$iJ}@p7!G@SyU/je1bEyWg}upLu-6V6-Lg9VD(]siH,r.,m-r|ulZ,U4LC/SeR)'
  24. _NETRC_MACHINE = 'viki'
  25. _token = None
  26. _ERRORS = {
  27. 'geo': 'Sorry, this content is not available in your region.',
  28. 'upcoming': 'Sorry, this content is not yet available.',
  29. # 'paywall': 'paywall',
  30. }
  31. def _prepare_call(self, path, timestamp=None, post_data=None):
  32. path += '?' if '?' not in path else '&'
  33. if not timestamp:
  34. timestamp = int(time.time())
  35. query = self._API_QUERY_TEMPLATE % (path, self._APP, timestamp)
  36. if self._token:
  37. query += '&token=%s' % self._token
  38. sig = hmac.new(
  39. self._APP_SECRET.encode('ascii'),
  40. query.encode('ascii'),
  41. hashlib.sha1
  42. ).hexdigest()
  43. url = self._API_URL_TEMPLATE % (query, sig)
  44. return sanitized_Request(
  45. url, json.dumps(post_data).encode('utf-8')) if post_data else url
  46. def _call_api(self, path, video_id, note, timestamp=None, post_data=None):
  47. resp = self._download_json(
  48. self._prepare_call(path, timestamp, post_data), video_id, note)
  49. error = resp.get('error')
  50. if error:
  51. if error == 'invalid timestamp':
  52. resp = self._download_json(
  53. self._prepare_call(path, int(resp['current_timestamp']), post_data),
  54. video_id, '%s (retry)' % note)
  55. error = resp.get('error')
  56. if error:
  57. self._raise_error(resp['error'])
  58. return resp
  59. def _raise_error(self, error):
  60. raise ExtractorError(
  61. '%s returned error: %s' % (self.IE_NAME, error),
  62. expected=True)
  63. def _check_errors(self, data):
  64. for reason, status in data.get('blocking', {}).items():
  65. if status and reason in self._ERRORS:
  66. raise ExtractorError('%s said: %s' % (
  67. self.IE_NAME, self._ERRORS[reason]), expected=True)
  68. def _real_initialize(self):
  69. self._login()
  70. def _login(self):
  71. (username, password) = self._get_login_info()
  72. if username is None:
  73. return
  74. login_form = {
  75. 'login_id': username,
  76. 'password': password,
  77. }
  78. login = self._call_api(
  79. 'sessions.json', None,
  80. 'Logging in as %s' % username, post_data=login_form)
  81. self._token = login.get('token')
  82. if not self._token:
  83. self.report_warning('Unable to get session token, login has probably failed')
  84. @staticmethod
  85. def dict_selection(dict_obj, preferred_key, allow_fallback=True):
  86. if preferred_key in dict_obj:
  87. return dict_obj.get(preferred_key)
  88. if not allow_fallback:
  89. return
  90. filtered_dict = list(filter(None, [dict_obj.get(k) for k in dict_obj.keys()]))
  91. return filtered_dict[0] if filtered_dict else None
  92. class VikiIE(VikiBaseIE):
  93. IE_NAME = 'viki'
  94. _VALID_URL = r'%s(?:videos|player)/(?P<id>[0-9]+v)' % VikiBaseIE._VALID_URL_BASE
  95. _TESTS = [{
  96. 'url': 'http://www.viki.com/videos/1023585v-heirs-episode-14',
  97. 'info_dict': {
  98. 'id': '1023585v',
  99. 'ext': 'mp4',
  100. 'title': 'Heirs Episode 14',
  101. 'uploader': 'SBS',
  102. 'description': 'md5:c4b17b9626dd4b143dcc4d855ba3474e',
  103. 'upload_date': '20131121',
  104. 'age_limit': 13,
  105. },
  106. 'skip': 'Blocked in the US',
  107. }, {
  108. # clip
  109. 'url': 'http://www.viki.com/videos/1067139v-the-avengers-age-of-ultron-press-conference',
  110. 'md5': '86c0b5dbd4d83a6611a79987cc7a1989',
  111. 'info_dict': {
  112. 'id': '1067139v',
  113. 'ext': 'mp4',
  114. 'title': "'The Avengers: Age of Ultron' Press Conference",
  115. 'description': 'md5:d70b2f9428f5488321bfe1db10d612ea',
  116. 'duration': 352,
  117. 'timestamp': 1430380829,
  118. 'upload_date': '20150430',
  119. 'uploader': 'Arirang TV',
  120. 'like_count': int,
  121. 'age_limit': 0,
  122. }
  123. }, {
  124. 'url': 'http://www.viki.com/videos/1048879v-ankhon-dekhi',
  125. 'info_dict': {
  126. 'id': '1048879v',
  127. 'ext': 'mp4',
  128. 'title': 'Ankhon Dekhi',
  129. 'duration': 6512,
  130. 'timestamp': 1408532356,
  131. 'upload_date': '20140820',
  132. 'uploader': 'Spuul',
  133. 'like_count': int,
  134. 'age_limit': 13,
  135. },
  136. 'skip': 'Blocked in the US',
  137. }, {
  138. # episode
  139. 'url': 'http://www.viki.com/videos/44699v-boys-over-flowers-episode-1',
  140. 'md5': '5fa476a902e902783ac7a4d615cdbc7a',
  141. 'info_dict': {
  142. 'id': '44699v',
  143. 'ext': 'mp4',
  144. 'title': 'Boys Over Flowers - Episode 1',
  145. 'description': 'md5:b89cf50038b480b88b5b3c93589a9076',
  146. 'duration': 4204,
  147. 'timestamp': 1270496524,
  148. 'upload_date': '20100405',
  149. 'uploader': 'group8',
  150. 'like_count': int,
  151. 'age_limit': 13,
  152. }
  153. }, {
  154. # youtube external
  155. 'url': 'http://www.viki.com/videos/50562v-poor-nastya-complete-episode-1',
  156. 'md5': '63f8600c1da6f01b7640eee7eca4f1da',
  157. 'info_dict': {
  158. 'id': '50562v',
  159. 'ext': 'webm',
  160. 'title': 'Poor Nastya [COMPLETE] - Episode 1',
  161. 'description': '',
  162. 'duration': 606,
  163. 'timestamp': 1274949505,
  164. 'upload_date': '20101213',
  165. 'uploader': 'ad14065n',
  166. 'uploader_id': 'ad14065n',
  167. 'like_count': int,
  168. 'age_limit': 13,
  169. }
  170. }, {
  171. 'url': 'http://www.viki.com/player/44699v',
  172. 'only_matching': True,
  173. }, {
  174. # non-English description
  175. 'url': 'http://www.viki.com/videos/158036v-love-in-magic',
  176. 'md5': '1713ae35df5a521b31f6dc40730e7c9c',
  177. 'info_dict': {
  178. 'id': '158036v',
  179. 'ext': 'mp4',
  180. 'uploader': 'I Planet Entertainment',
  181. 'upload_date': '20111122',
  182. 'timestamp': 1321985454,
  183. 'description': 'md5:44b1e46619df3a072294645c770cef36',
  184. 'title': 'Love In Magic',
  185. 'age_limit': 13,
  186. },
  187. }]
  188. def _real_extract(self, url):
  189. video_id = self._match_id(url)
  190. video = self._call_api(
  191. 'videos/%s.json' % video_id, video_id, 'Downloading video JSON')
  192. self._check_errors(video)
  193. title = self.dict_selection(video.get('titles', {}), 'en', allow_fallback=False)
  194. if not title:
  195. title = 'Episode %d' % video.get('number') if video.get('type') == 'episode' else video.get('id') or video_id
  196. container_titles = video.get('container', {}).get('titles', {})
  197. container_title = self.dict_selection(container_titles, 'en')
  198. title = '%s - %s' % (container_title, title)
  199. description = self.dict_selection(video.get('descriptions', {}), 'en')
  200. duration = int_or_none(video.get('duration'))
  201. timestamp = parse_iso8601(video.get('created_at'))
  202. uploader = video.get('author')
  203. like_count = int_or_none(video.get('likes', {}).get('count'))
  204. age_limit = parse_age_limit(video.get('rating'))
  205. thumbnails = []
  206. for thumbnail_id, thumbnail in video.get('images', {}).items():
  207. thumbnails.append({
  208. 'id': thumbnail_id,
  209. 'url': thumbnail.get('url'),
  210. })
  211. subtitles = {}
  212. for subtitle_lang, _ in video.get('subtitle_completions', {}).items():
  213. subtitles[subtitle_lang] = [{
  214. 'ext': subtitles_format,
  215. 'url': self._prepare_call(
  216. 'videos/%s/subtitles/%s.%s' % (video_id, subtitle_lang, subtitles_format)),
  217. } for subtitles_format in ('srt', 'vtt')]
  218. result = {
  219. 'id': video_id,
  220. 'title': title,
  221. 'description': description,
  222. 'duration': duration,
  223. 'timestamp': timestamp,
  224. 'uploader': uploader,
  225. 'like_count': like_count,
  226. 'age_limit': age_limit,
  227. 'thumbnails': thumbnails,
  228. 'subtitles': subtitles,
  229. }
  230. streams = self._call_api(
  231. 'videos/%s/streams.json' % video_id, video_id,
  232. 'Downloading video streams JSON')
  233. if 'external' in streams:
  234. result.update({
  235. '_type': 'url_transparent',
  236. 'url': streams['external']['url'],
  237. })
  238. return result
  239. formats = []
  240. for format_id, stream_dict in streams.items():
  241. height = int_or_none(self._search_regex(
  242. r'^(\d+)[pP]$', format_id, 'height', default=None))
  243. for protocol, format_dict in stream_dict.items():
  244. # rtmps URLs does not seem to work
  245. if protocol == 'rtmps':
  246. continue
  247. format_url = format_dict['url']
  248. if format_id == 'm3u8':
  249. m3u8_formats = self._extract_m3u8_formats(
  250. format_url, video_id, 'mp4',
  251. entry_protocol='m3u8_native',
  252. m3u8_id='m3u8-%s' % protocol, fatal=False)
  253. # Despite CODECS metadata in m3u8 all video-only formats
  254. # are actually video+audio
  255. for f in m3u8_formats:
  256. if f.get('acodec') == 'none' and f.get('vcodec') != 'none':
  257. f['acodec'] = None
  258. formats.extend(m3u8_formats)
  259. elif format_url.startswith('rtmp'):
  260. mobj = re.search(
  261. r'^(?P<url>rtmp://[^/]+/(?P<app>.+?))/(?P<playpath>mp4:.+)$',
  262. format_url)
  263. if not mobj:
  264. continue
  265. formats.append({
  266. 'format_id': 'rtmp-%s' % format_id,
  267. 'ext': 'flv',
  268. 'url': mobj.group('url'),
  269. 'play_path': mobj.group('playpath'),
  270. 'app': mobj.group('app'),
  271. 'page_url': url,
  272. })
  273. else:
  274. formats.append({
  275. 'url': format_url,
  276. 'format_id': '%s-%s' % (format_id, protocol),
  277. 'height': height,
  278. })
  279. self._sort_formats(formats)
  280. result['formats'] = formats
  281. return result
  282. class VikiChannelIE(VikiBaseIE):
  283. IE_NAME = 'viki:channel'
  284. _VALID_URL = r'%s(?:tv|news|movies|artists)/(?P<id>[0-9]+c)' % VikiBaseIE._VALID_URL_BASE
  285. _TESTS = [{
  286. 'url': 'http://www.viki.com/tv/50c-boys-over-flowers',
  287. 'info_dict': {
  288. 'id': '50c',
  289. 'title': 'Boys Over Flowers',
  290. 'description': 'md5:ecd3cff47967fe193cff37c0bec52790',
  291. },
  292. 'playlist_mincount': 71,
  293. }, {
  294. 'url': 'http://www.viki.com/tv/1354c-poor-nastya-complete',
  295. 'info_dict': {
  296. 'id': '1354c',
  297. 'title': 'Poor Nastya [COMPLETE]',
  298. 'description': 'md5:05bf5471385aa8b21c18ad450e350525',
  299. },
  300. 'playlist_count': 127,
  301. }, {
  302. 'url': 'http://www.viki.com/news/24569c-showbiz-korea',
  303. 'only_matching': True,
  304. }, {
  305. 'url': 'http://www.viki.com/movies/22047c-pride-and-prejudice-2005',
  306. 'only_matching': True,
  307. }, {
  308. 'url': 'http://www.viki.com/artists/2141c-shinee',
  309. 'only_matching': True,
  310. }]
  311. _PER_PAGE = 25
  312. def _real_extract(self, url):
  313. channel_id = self._match_id(url)
  314. channel = self._call_api(
  315. 'containers/%s.json' % channel_id, channel_id,
  316. 'Downloading channel JSON')
  317. self._check_errors(channel)
  318. title = self.dict_selection(channel['titles'], 'en')
  319. description = self.dict_selection(channel['descriptions'], 'en')
  320. entries = []
  321. for video_type in ('episodes', 'clips', 'movies'):
  322. for page_num in itertools.count(1):
  323. page = self._call_api(
  324. 'containers/%s/%s.json?per_page=%d&sort=number&direction=asc&with_paging=true&page=%d'
  325. % (channel_id, video_type, self._PER_PAGE, page_num), channel_id,
  326. 'Downloading %s JSON page #%d' % (video_type, page_num))
  327. for video in page['response']:
  328. video_id = video['id']
  329. entries.append(self.url_result(
  330. 'http://www.viki.com/videos/%s' % video_id, 'Viki'))
  331. if not page['pagination']['next']:
  332. break
  333. return self.playlist_result(entries, channel_id, title, description)