[extractor/playsuisse] Support new url format (#6528)

Authored by: sbor23
This commit is contained in:
Stefan Borer 2023-05-29 07:26:49 +02:00 committed by GitHub
parent c6d4b82a8b
commit 94627c5dde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,16 @@
class PlaySuisseIE(InfoExtractor): class PlaySuisseIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/watch/(?P<id>[0-9]+)' _VALID_URL = r'https?://(?:www\.)?playsuisse\.ch/(?:watch|detail)/(?:[^#]*[?&]episodeId=)?(?P<id>[0-9]+)'
_TESTS = [ _TESTS = [
{ {
# Old URL
'url': 'https://www.playsuisse.ch/watch/763211/0', 'url': 'https://www.playsuisse.ch/watch/763211/0',
'only_matching': True,
},
{
# episode in a series
'url': 'https://www.playsuisse.ch/watch/763182?episodeId=763211',
'md5': '82df2a470b2dfa60c2d33772a8a60cf8', 'md5': '82df2a470b2dfa60c2d33772a8a60cf8',
'info_dict': { 'info_dict': {
'id': '763211', 'id': '763211',
@ -21,11 +27,11 @@ class PlaySuisseIE(InfoExtractor):
'season_number': 1, 'season_number': 1,
'episode': 'Knochen', 'episode': 'Knochen',
'episode_number': 1, 'episode_number': 1,
'thumbnail': 'md5:9260abe0c0ec9b69914d0a10d54c5878' 'thumbnail': 're:https://playsuisse-img.akamaized.net/',
} }
}, }, {
{ # film
'url': 'https://www.playsuisse.ch/watch/808675/0', 'url': 'https://www.playsuisse.ch/watch/808675',
'md5': '818b94c1d2d7c4beef953f12cb8f3e75', 'md5': '818b94c1d2d7c4beef953f12cb8f3e75',
'info_dict': { 'info_dict': {
'id': '808675', 'id': '808675',
@ -33,26 +39,60 @@ class PlaySuisseIE(InfoExtractor):
'title': 'Der Läufer', 'title': 'Der Läufer',
'description': 'md5:9f61265c7e6dcc3e046137a792b275fd', 'description': 'md5:9f61265c7e6dcc3e046137a792b275fd',
'duration': 5280, 'duration': 5280,
'episode': 'Der Läufer', 'thumbnail': 're:https://playsuisse-img.akamaized.net/',
'thumbnail': 'md5:44af7d65ee02bbba4576b131868bb783'
} }
}, }, {
{ # series (treated as a playlist)
'url': 'https://www.playsuisse.ch/watch/817193/0', 'url': 'https://www.playsuisse.ch/detail/1115687',
'md5': '1d6c066f92cd7fffd8b28a53526d6b59',
'info_dict': { 'info_dict': {
'id': '817193', 'description': 'md5:e4a2ae29a8895823045b5c3145a02aa3',
'ext': 'mp4', 'id': '1115687',
'title': 'Die Einweihungsparty', 'series': 'They all came out to Montreux',
'description': 'md5:91ebf04d3a42cb3ab70666acf750a930', 'title': 'They all came out to Montreux',
'duration': 1380, },
'series': 'Nr. 47', 'playlist': [{
'info_dict': {
'description': 'md5:f2462744834b959a31adc6292380cda2',
'duration': 3180,
'episode': 'Folge 1',
'episode_number': 1,
'id': '1112663',
'season': 'Season 1', 'season': 'Season 1',
'season_number': 1, 'season_number': 1,
'episode': 'Die Einweihungsparty', 'series': 'They all came out to Montreux',
'episode_number': 1, 'thumbnail': 're:https://playsuisse-img.akamaized.net/',
'thumbnail': 'md5:637585fb106e3a4bcd991958924c7e44' 'title': 'Folge 1',
'ext': 'mp4'
},
}, {
'info_dict': {
'description': 'md5:9dfd308699fe850d3bce12dc1bad9b27',
'duration': 2935,
'episode': 'Folge 2',
'episode_number': 2,
'id': '1112661',
'season': 'Season 1',
'season_number': 1,
'series': 'They all came out to Montreux',
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
'title': 'Folge 2',
'ext': 'mp4'
},
}, {
'info_dict': {
'description': 'md5:14a93a3356b2492a8f786ab2227ef602',
'duration': 2994,
'episode': 'Folge 3',
'episode_number': 3,
'id': '1112664',
'season': 'Season 1',
'season_number': 1,
'series': 'They all came out to Montreux',
'thumbnail': 're:https://playsuisse-img.akamaized.net/',
'title': 'Folge 3',
'ext': 'mp4'
} }
}],
} }
] ]
@ -142,6 +182,6 @@ def _extract_single(self, media_data):
'subtitles': subtitles, 'subtitles': subtitles,
'series': media_data.get('seriesName'), 'series': media_data.get('seriesName'),
'season_number': int_or_none(media_data.get('seasonNumber')), 'season_number': int_or_none(media_data.get('seasonNumber')),
'episode': media_data.get('name'), 'episode': media_data.get('name') if media_data.get('episodeNumber') else None,
'episode_number': int_or_none(media_data.get('episodeNumber')), 'episode_number': int_or_none(media_data.get('episodeNumber')),
} }