|
|
|
@ -3,8 +3,14 @@ from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
|
from .mtv import MTVServicesInfoExtractor
|
|
|
|
|
from ..utils import update_url_query
|
|
|
|
|
from ..utils import (
|
|
|
|
|
try_get,
|
|
|
|
|
update_url_query,
|
|
|
|
|
int_or_none,
|
|
|
|
|
ExtractorError,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NickIE(MTVServicesInfoExtractor):
|
|
|
|
@ -247,3 +253,42 @@ class NickRuIE(MTVServicesInfoExtractor):
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
mgid = self._extract_mgid(webpage)
|
|
|
|
|
return self.url_result('http://media.mtvnservices.com/embed/%s' % mgid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NickIlIE(InfoExtractor):
|
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?nick\.co\.il/video/(?P<id>\d+)'
|
|
|
|
|
_TEST = {
|
|
|
|
|
'url': 'http://www.nick.co.il/video/17360',
|
|
|
|
|
'md5': '0974ad5949022e0477a5a28ee5b85634',
|
|
|
|
|
'info_dict': {
|
|
|
|
|
'id': '17360',
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
'title': '\u05e9\u05d9\u05e8 \u05d4\u05e4\u05ea\u05d9\u05d7\u05d4 \u05e9\u05dc \u05d3\u05d5\u05e8\u05d2 \u05d5\u05d0\u05df \u05d3\u05e0\u05d2\u05d5',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
items = self._download_json(
|
|
|
|
|
'http://nickplay.ilovegames.co.il/api/nicktogoapi/GetItems', video_id,
|
|
|
|
|
query={
|
|
|
|
|
'countryCode': 'IL',
|
|
|
|
|
'deviceId': '',
|
|
|
|
|
'isApp': 0,
|
|
|
|
|
'itemId': video_id,
|
|
|
|
|
}).get('items')
|
|
|
|
|
if items is None:
|
|
|
|
|
raise ExtractorError('Unable to extract video data', expected=True, video_id=video_id)
|
|
|
|
|
video = try_get([i for i in items if i.get('id') == int(video_id)], lambda x: x[0], dict)
|
|
|
|
|
if video is None:
|
|
|
|
|
raise ExtractorError('Unable to find video ID', expected=True, video_id=video_id)
|
|
|
|
|
url = video.get('url')
|
|
|
|
|
if url is None:
|
|
|
|
|
raise ExtractorError('Unable to extract video data', expected=True, video_id=video_id)
|
|
|
|
|
formats = self._extract_m3u8_formats(url, video_id, ext='mp4')
|
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
|
|
|
|
'title': video.get('title'),
|
|
|
|
|
'duration': int_or_none(video.get('duration'), scale=1000),
|
|
|
|
|
'formats': formats,
|
|
|
|
|
}
|
|
|
|
|