mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 12:49:02 +01:00
[mediaset] Fix issues and extract all formats (closes #16568)
This commit is contained in:
parent
9cf648c92b
commit
267d81962a
@ -10,7 +10,6 @@ from ..utils import (
|
|||||||
parse_duration,
|
parse_duration,
|
||||||
try_get,
|
try_get,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
ExtractorError
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ class MediasetIE(InfoExtractor):
|
|||||||
'series': 'Matrix',
|
'series': 'Matrix',
|
||||||
'categories': ['infotainment'],
|
'categories': ['infotainment'],
|
||||||
},
|
},
|
||||||
'expected_warnings': ['is not a supported codec'],
|
'expected_warnings': ['HTTP Error 403: Forbidden'],
|
||||||
}, {
|
}, {
|
||||||
# clip
|
# clip
|
||||||
'url': 'http://www.video.mediaset.it/video/gogglebox/clip/un-grande-classico-della-commedia-sexy_661680.html',
|
'url': 'http://www.video.mediaset.it/video/gogglebox/clip/un-grande-classico-della-commedia-sexy_661680.html',
|
||||||
@ -87,13 +86,14 @@ class MediasetIE(InfoExtractor):
|
|||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
media_info = self._download_json(
|
video = self._download_json(
|
||||||
'https://www.video.mediaset.it/html/metainfo.sjson',
|
'https://www.video.mediaset.it/html/metainfo.sjson',
|
||||||
video_id, 'Downloading media info', query={
|
video_id, 'Downloading media info', query={
|
||||||
'id': video_id
|
'id': video_id
|
||||||
})['video']
|
})['video']
|
||||||
|
|
||||||
media_id = try_get(media_info, lambda x: x['guid']) or video_id
|
title = video['title']
|
||||||
|
media_id = video.get('guid') or video_id
|
||||||
|
|
||||||
video_list = self._download_json(
|
video_list = self._download_json(
|
||||||
'http://cdnsel01.mediaset.net/GetCdn2018.aspx',
|
'http://cdnsel01.mediaset.net/GetCdn2018.aspx',
|
||||||
@ -104,12 +104,17 @@ class MediasetIE(InfoExtractor):
|
|||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for format_url in video_list:
|
for format_url in video_list:
|
||||||
if '.ism' in format_url:
|
ext = determine_ext(format_url)
|
||||||
try:
|
if ext == 'm3u8':
|
||||||
|
formats.extend(self._extract_m3u8_formats(
|
||||||
|
format_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
|
m3u8_id='hls', fatal=False))
|
||||||
|
elif ext == 'mpd':
|
||||||
|
formats.extend(self._extract_mpd_formats(
|
||||||
|
format_url, video_id, mpd_id='dash', fatal=False))
|
||||||
|
elif ext == 'ism' or '.ism' in format_url:
|
||||||
formats.extend(self._extract_ism_formats(
|
formats.extend(self._extract_ism_formats(
|
||||||
format_url, video_id, ism_id='mss', fatal=False))
|
format_url, video_id, ism_id='mss', fatal=False))
|
||||||
except ExtractorError:
|
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
formats.append({
|
formats.append({
|
||||||
'url': format_url,
|
'url': format_url,
|
||||||
@ -117,24 +122,23 @@ class MediasetIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = media_info['title']
|
|
||||||
|
|
||||||
creator = try_get(
|
creator = try_get(
|
||||||
media_info, lambda x: x['brand-info']['publisher'], compat_str)
|
video, lambda x: x['brand-info']['publisher'], compat_str)
|
||||||
category = try_get(
|
category = try_get(
|
||||||
media_info, lambda x: x['brand-info']['category'], compat_str)
|
video, lambda x: x['brand-info']['category'], compat_str)
|
||||||
categories = [category] if category else None
|
categories = [category] if category else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'description': media_info.get('short-description'),
|
'description': video.get('short-description'),
|
||||||
'thumbnail': media_info.get('thumbnail'),
|
'thumbnail': video.get('thumbnail'),
|
||||||
'duration': parse_duration(media_info.get('duration')),
|
'duration': parse_duration(video.get('duration')),
|
||||||
'creator': creator,
|
'creator': creator,
|
||||||
'upload_date': unified_strdate(media_info.get('production-date')),
|
'upload_date': unified_strdate(video.get('production-date')),
|
||||||
'webpage_url': media_info.get('url'),
|
'webpage_url': video.get('url'),
|
||||||
'series': media_info.get('brand-value'),
|
'series': video.get('brand-value'),
|
||||||
|
'season': video.get('season'),
|
||||||
'categories': categories,
|
'categories': categories,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user