mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-01-29 23:00:11 +09:00
Merge 1334304793
into d55d1f423d
This commit is contained in:
commit
cd7d1947f6
@ -33,6 +33,7 @@ class HotStarBaseIE(InfoExtractor):
|
|||||||
auth += '~hmac=' + hmac.new(self._AKAMAI_ENCRYPTION_KEY, auth.encode(), hashlib.sha256).hexdigest()
|
auth += '~hmac=' + hmac.new(self._AKAMAI_ENCRYPTION_KEY, auth.encode(), hashlib.sha256).hexdigest()
|
||||||
h = {'hotstarauth': auth}
|
h = {'hotstarauth': auth}
|
||||||
h.update(headers)
|
h.update(headers)
|
||||||
|
|
||||||
return self._download_json(
|
return self._download_json(
|
||||||
'https://api.hotstar.com/' + path,
|
'https://api.hotstar.com/' + path,
|
||||||
video_id, headers=h, query=query, data=data)
|
video_id, headers=h, query=query, data=data)
|
||||||
@ -59,7 +60,8 @@ class HotStarBaseIE(InfoExtractor):
|
|||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
if isinstance(e.cause, compat_HTTPError):
|
if isinstance(e.cause, compat_HTTPError):
|
||||||
if e.cause.code == 402:
|
if e.cause.code == 402:
|
||||||
self.raise_login_required()
|
raise ExtractorError('This video is only available for registered users. You may want to use --cookies.', expected=True)
|
||||||
|
|
||||||
message = self._parse_json(e.cause.read().decode(), video_id)['message']
|
message = self._parse_json(e.cause.read().decode(), video_id)['message']
|
||||||
if message in ('Content not available in region', 'Country is not supported'):
|
if message in ('Content not available in region', 'Country is not supported'):
|
||||||
raise self.raise_geo_restricted(message)
|
raise self.raise_geo_restricted(message)
|
||||||
@ -135,6 +137,13 @@ class HotStarIE(HotStarBaseIE):
|
|||||||
formats = []
|
formats = []
|
||||||
geo_restricted = False
|
geo_restricted = False
|
||||||
|
|
||||||
|
for cookie in self._downloader.cookiejar:
|
||||||
|
if "hotstar" in cookie.domain:
|
||||||
|
if cookie.name == "userUP":
|
||||||
|
self._USER_TOKEN = cookie.value
|
||||||
|
elif cookie.name == "device-id":
|
||||||
|
self._DEVICE_ID = cookie.value
|
||||||
|
|
||||||
if not self._USER_TOKEN:
|
if not self._USER_TOKEN:
|
||||||
self._DEVICE_ID = compat_str(uuid.uuid4())
|
self._DEVICE_ID = compat_str(uuid.uuid4())
|
||||||
self._USER_TOKEN = self._call_api_v2('um/v3/users', video_id, {
|
self._USER_TOKEN = self._call_api_v2('um/v3/users', video_id, {
|
||||||
|
Loading…
Reference in New Issue
Block a user