mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 04:10:23 +00:00
[prosiebensat1] improve geo restriction handling(closes #23571)
This commit is contained in:
parent
75ef77c1b1
commit
0c15a56f1c
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class ProSiebenSat1BaseIE(InfoExtractor):
|
class ProSiebenSat1BaseIE(InfoExtractor):
|
||||||
_GEO_COUNTRIES = ['DE']
|
_GEO_BYPASS = False
|
||||||
_ACCESS_ID = None
|
_ACCESS_ID = None
|
||||||
_SUPPORTED_PROTOCOLS = 'dash:clear,hls:clear,progressive:clear'
|
_SUPPORTED_PROTOCOLS = 'dash:clear,hls:clear,progressive:clear'
|
||||||
_V4_BASE_URL = 'https://vas-v4.p7s1video.net/4.0/get'
|
_V4_BASE_URL = 'https://vas-v4.p7s1video.net/4.0/get'
|
||||||
@ -39,14 +39,18 @@ def _extract_video_info(self, url, clip_id):
|
|||||||
formats = []
|
formats = []
|
||||||
if self._ACCESS_ID:
|
if self._ACCESS_ID:
|
||||||
raw_ct = self._ENCRYPTION_KEY + clip_id + self._IV + self._ACCESS_ID
|
raw_ct = self._ENCRYPTION_KEY + clip_id + self._IV + self._ACCESS_ID
|
||||||
server_token = (self._download_json(
|
protocols = self._download_json(
|
||||||
self._V4_BASE_URL + 'protocols', clip_id,
|
self._V4_BASE_URL + 'protocols', clip_id,
|
||||||
'Downloading protocols JSON',
|
'Downloading protocols JSON',
|
||||||
headers=self.geo_verification_headers(), query={
|
headers=self.geo_verification_headers(), query={
|
||||||
'access_id': self._ACCESS_ID,
|
'access_id': self._ACCESS_ID,
|
||||||
'client_token': sha1((raw_ct).encode()).hexdigest(),
|
'client_token': sha1((raw_ct).encode()).hexdigest(),
|
||||||
'video_id': clip_id,
|
'video_id': clip_id,
|
||||||
}, fatal=False) or {}).get('server_token')
|
}, fatal=False, expected_status=(403,)) or {}
|
||||||
|
error = protocols.get('error') or {}
|
||||||
|
if error.get('title') == 'Geo check failed':
|
||||||
|
self.raise_geo_restricted(countries=['AT', 'CH', 'DE'])
|
||||||
|
server_token = protocols.get('server_token')
|
||||||
if server_token:
|
if server_token:
|
||||||
urls = (self._download_json(
|
urls = (self._download_json(
|
||||||
self._V4_BASE_URL + 'urls', clip_id, 'Downloading urls JSON', query={
|
self._V4_BASE_URL + 'urls', clip_id, 'Downloading urls JSON', query={
|
||||||
|
Loading…
Reference in New Issue
Block a user