mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-02 09:12:40 +01:00
parent
1fe3c4c27e
commit
0222620725
@ -30,20 +30,20 @@ class MediasetIE(ThePlatformBaseIE):
|
|||||||
'''
|
'''
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# full episode
|
# full episode
|
||||||
'url': 'https://www.mediasetplay.mediaset.it/video/hellogoodbye/quarta-puntata_FAFU000000661824',
|
'url': 'https://www.mediasetplay.mediaset.it/video/mrwronglezionidamore/episodio-1_F310575103000102',
|
||||||
'md5': '9b75534d42c44ecef7bf1ffeacb7f85d',
|
'md5': 'a7e75c6384871f322adb781d3bd72c26',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'FAFU000000661824',
|
'id': 'F310575103000102',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Quarta puntata',
|
'title': 'Episodio 1',
|
||||||
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
|
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
|
||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
'duration': 1414.26,
|
'duration': 2682.0,
|
||||||
'upload_date': '20161107',
|
'upload_date': '20210530',
|
||||||
'series': 'Hello Goodbye',
|
'series': 'Mr Wrong - Lezioni d\'amore',
|
||||||
'timestamp': 1478532900,
|
'timestamp': 1622413946,
|
||||||
'uploader': 'Rete 4',
|
'uploader': 'Canale 5',
|
||||||
'uploader_id': 'R4',
|
'uploader_id': 'C5',
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.mediasetplay.mediaset.it/video/matrix/puntata-del-25-maggio_F309013801000501',
|
'url': 'https://www.mediasetplay.mediaset.it/video/matrix/puntata-del-25-maggio_F309013801000501',
|
||||||
@ -54,10 +54,10 @@ class MediasetIE(ThePlatformBaseIE):
|
|||||||
'title': 'Puntata del 25 maggio',
|
'title': 'Puntata del 25 maggio',
|
||||||
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
|
'description': 'md5:d41d8cd98f00b204e9800998ecf8427e',
|
||||||
'thumbnail': r're:^https?://.*\.jpg$',
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
'duration': 6565.007,
|
'duration': 6565.008,
|
||||||
'upload_date': '20180526',
|
'upload_date': '20200903',
|
||||||
'series': 'Matrix',
|
'series': 'Matrix',
|
||||||
'timestamp': 1527326245,
|
'timestamp': 1599172492,
|
||||||
'uploader': 'Canale 5',
|
'uploader': 'Canale 5',
|
||||||
'uploader_id': 'C5',
|
'uploader_id': 'C5',
|
||||||
},
|
},
|
||||||
@ -135,36 +135,38 @@ def _real_extract(self, url):
|
|||||||
formats = []
|
formats = []
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
first_e = None
|
first_e = None
|
||||||
for asset_type in ('SD', 'HD'):
|
asset_type = 'HD,browser,geoIT|SD,browser,geoIT|geoNo:HD,browser,geoIT|geoNo:SD,browser,geoIT|geoNo'
|
||||||
# TODO: fixup ISM+none manifest URLs
|
# TODO: fixup ISM+none manifest URLs
|
||||||
for f in ('MPEG4', 'MPEG-DASH+none', 'M3U+none'):
|
for f in ('MPEG4', 'MPEG-DASH+none', 'M3U+none'):
|
||||||
try:
|
try:
|
||||||
tp_formats, tp_subtitles = self._extract_theplatform_smil(
|
tp_formats, tp_subtitles = self._extract_theplatform_smil(
|
||||||
update_url_query('http://link.theplatform.%s/s/%s' % (self._TP_TLD, tp_path), {
|
update_url_query('http://link.theplatform.%s/s/%s' % (self._TP_TLD, tp_path), {
|
||||||
'mbr': 'true',
|
'mbr': 'true',
|
||||||
'formats': f,
|
'formats': f,
|
||||||
'assetTypes': asset_type,
|
'assetTypes': asset_type,
|
||||||
}), guid, 'Downloading %s %s SMIL data' % (f.split('+')[0], asset_type))
|
}), guid, 'Downloading %s SMIL data' % (f.split('+')[0]))
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if not first_e:
|
if not first_e:
|
||||||
first_e = e
|
first_e = e
|
||||||
break
|
break
|
||||||
for tp_f in tp_formats:
|
formats.extend(tp_formats)
|
||||||
tp_f['quality'] = 1 if asset_type == 'HD' else 0
|
subtitles = self._merge_subtitles(subtitles, tp_subtitles)
|
||||||
formats.extend(tp_formats)
|
|
||||||
subtitles = self._merge_subtitles(subtitles, tp_subtitles)
|
|
||||||
if first_e and not formats:
|
if first_e and not formats:
|
||||||
raise first_e
|
raise first_e
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
fields = []
|
|
||||||
for templ, repls in (('tvSeason%sNumber', ('', 'Episode')), ('mediasetprogram$%s', ('brandTitle', 'numberOfViews', 'publishInfo'))):
|
|
||||||
fields.extend(templ % repl for repl in repls)
|
|
||||||
feed_data = self._download_json(
|
feed_data = self._download_json(
|
||||||
'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs/guid/-/' + guid,
|
'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2/guid/-/' + guid,
|
||||||
guid, fatal=False, query={'fields': ','.join(fields)})
|
guid, fatal=False)
|
||||||
if feed_data:
|
if feed_data:
|
||||||
publish_info = feed_data.get('mediasetprogram$publishInfo') or {}
|
publish_info = feed_data.get('mediasetprogram$publishInfo') or {}
|
||||||
|
thumbnails = feed_data.get('thumbnails') or {}
|
||||||
|
thumbnail = None
|
||||||
|
for key, value in thumbnails.items():
|
||||||
|
if key.startswith('image_keyframe_poster-'):
|
||||||
|
thumbnail = value.get('url')
|
||||||
|
break
|
||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
'episode_number': int_or_none(feed_data.get('tvSeasonEpisodeNumber')),
|
'episode_number': int_or_none(feed_data.get('tvSeasonEpisodeNumber')),
|
||||||
'season_number': int_or_none(feed_data.get('tvSeasonNumber')),
|
'season_number': int_or_none(feed_data.get('tvSeasonNumber')),
|
||||||
@ -172,6 +174,7 @@ def _real_extract(self, url):
|
|||||||
'uploader': publish_info.get('description'),
|
'uploader': publish_info.get('description'),
|
||||||
'uploader_id': publish_info.get('channel'),
|
'uploader_id': publish_info.get('channel'),
|
||||||
'view_count': int_or_none(feed_data.get('mediasetprogram$numberOfViews')),
|
'view_count': int_or_none(feed_data.get('mediasetprogram$numberOfViews')),
|
||||||
|
'thumbnail': thumbnail,
|
||||||
})
|
})
|
||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
|
Loading…
Reference in New Issue
Block a user