mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-05-19 11:39:28 +00:00
Merge 3ecfa9f9f7
into 00ef748cc0
This commit is contained in:
commit
9a9f55a56f
|
@ -815,6 +815,7 @@ from .nick import (
|
|||
NickDeIE,
|
||||
NickNightIE,
|
||||
NickRuIE,
|
||||
NickIlIE,
|
||||
)
|
||||
from .niconico import (
|
||||
NiconicoIE,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue