mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-05 19:10:10 +09:00
[nickil] Make more robust
This commit is contained in:
parent
30edba52e4
commit
6a2342c7af
@ -6,8 +6,10 @@ import re
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .mtv import MTVServicesInfoExtractor
|
from .mtv import MTVServicesInfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
try_get,
|
||||||
update_url_query,
|
update_url_query,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -268,22 +270,21 @@ class NickIlIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
items = self._download_json(
|
items = self._download_json(
|
||||||
'http://nickplay.ilovegames.co.il/api/nicktogoapi/GetItems', video_id, query={
|
'http://nickplay.ilovegames.co.il/api/nicktogoapi/GetItems', video_id,
|
||||||
|
query={
|
||||||
'countryCode': 'IL',
|
'countryCode': 'IL',
|
||||||
'deviceId': '',
|
'deviceId': '',
|
||||||
'isApp': 0,
|
'isApp': 0,
|
||||||
'itemId': video_id,
|
'itemId': video_id,
|
||||||
}
|
}).get('items')
|
||||||
).get('items')
|
|
||||||
if items is None:
|
if items is None:
|
||||||
return {}
|
raise ExtractorError('Unable to extract video data', expected=True, video_id=video_id)
|
||||||
try:
|
video = try_get([i for i in items if i.get('id') == int(video_id)] or None, lambda x: x[0], dict)
|
||||||
video = next(filter(lambda i: i.get('id') == int(video_id), items))
|
if video is None:
|
||||||
except StopIteration:
|
raise ExtractorError('Unable to find video ID', expected=True, video_id=video_id)
|
||||||
return {}
|
|
||||||
url = video.get('url')
|
url = video.get('url')
|
||||||
if url is None:
|
if url is None:
|
||||||
return {}
|
raise ExtractorError('Unable to extract video data', expected=True, video_id=video_id)
|
||||||
formats = self._extract_m3u8_formats(url, video_id, ext='mp4')
|
formats = self._extract_m3u8_formats(url, video_id, ext='mp4')
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user