Compare commits

...

6 Commits

Author SHA1 Message Date
v3DJG6GL
154e312502
from ..utils import join_nonempty / from ..utils.traversal import unpack 2025-05-09 02:45:43 +02:00
v3DJG6GL
37522a2ad0
Update yt_dlp/extractor/playsuisse.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2025-05-09 02:41:14 +02:00
v3DJG6GL
71922f7a81
Update yt_dlp/extractor/playsuisse.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2025-05-09 02:41:02 +02:00
v3DJG6GL
c85356d2ad
Update yt_dlp/extractor/playsuisse.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2025-05-09 02:40:35 +02:00
v3DJG6GL
06b65310ce
Update yt_dlp/extractor/playsuisse.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2025-05-09 02:39:17 +02:00
v3DJG6GL
a707060056
Update yt_dlp/extractor/playsuisse.py
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2025-05-09 02:37:38 +02:00

View File

@ -7,11 +7,13 @@ from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
join_nonempty,
parse_qs,
traverse_obj,
update_url_query,
urlencode_postdata,
)
from ..utils.traversal import unpack
class PlaySuisseIE(InfoExtractor):
@ -230,7 +232,7 @@ class PlaySuisseIE(InfoExtractor):
if not self._ID_TOKEN:
raise ExtractorError('Login failed')
def _get_media_data(self, media_id, locale):
def _get_media_data(self, media_id, locale=None):
response = self._download_json(
'https://www.playsuisse.ch/api/graphql',
media_id, data=json.dumps({
@ -238,7 +240,8 @@ class PlaySuisseIE(InfoExtractor):
'query': self._GRAPHQL_QUERY,
'variables': {'assetId': media_id},
}).encode(),
headers={'Content-Type': 'application/json', 'locale': locale})
headers={'Content-Type': 'application/json', 'locale': locale or 'de'})
return response['data']['assetV2']
def _real_extract(self, url):
@ -246,7 +249,7 @@ class PlaySuisseIE(InfoExtractor):
self.raise_login_required(method='password')
media_id = self._match_id(url)
media_data = self._get_media_data(media_id, traverse_obj(parse_qs(url), ('locale', 0), default='de'))
media_data = self._get_media_data(media_id, traverse_obj(parse_qs(url), ('locale', 0)))
info = self._extract_single(media_data)
if media_data.get('episodes'):
info.update({
@ -279,12 +282,12 @@ class PlaySuisseIE(InfoExtractor):
'genres': ('contentTypes', ..., {str}),
'creators': ('directors', ..., {str}),
'cast': ('mainCast', ..., {str}),
'location': ('productionCountries', ..., {str}, any),
'location': ('productionCountries', ..., {str}, all, {unpack(join_nonempty, delim='; ')}, filter),
'release_year': ('year', {int_or_none}),
'duration': ('duration', {int_or_none}),
'series': ('seriesName', {str}),
'season_number': ('seasonNumber', {int_or_none}),
'episode': ('name', {str}),
'episode': ('name', {str}, {lambda x: x if media_data['episodeNumber'] is not None else None}),
'episode_number': ('episodeNumber', {int_or_none}),
}),
}