|
|
@ -12,6 +12,7 @@ from ..compat import (
|
|
|
|
compat_str,
|
|
|
|
compat_str,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
|
|
|
|
HEADRequest,
|
|
|
|
ExtractorError,
|
|
|
|
ExtractorError,
|
|
|
|
float_or_none,
|
|
|
|
float_or_none,
|
|
|
|
orderedSet,
|
|
|
|
orderedSet,
|
|
|
@ -67,11 +68,28 @@ class GloboIE(InfoExtractor):
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
'url': 'globo:3607726',
|
|
|
|
'url': 'globo:3607726',
|
|
|
|
'only_matching': True,
|
|
|
|
'only_matching': True,
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
'url': 'https://globoplay.globo.com/v/10248083/',
|
|
|
|
|
|
|
|
'info_dict': {
|
|
|
|
|
|
|
|
'id': '10248083',
|
|
|
|
|
|
|
|
'ext': 'mp4',
|
|
|
|
|
|
|
|
'title': 'Melhores momentos: Equador 1 x 1 Brasil pelas Eliminatórias da Copa do Mundo 2022',
|
|
|
|
|
|
|
|
'duration': 530.964,
|
|
|
|
|
|
|
|
'uploader': 'SporTV',
|
|
|
|
|
|
|
|
'uploader_id': '698',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
'params': {
|
|
|
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
|
|
|
},
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._request_webpage(
|
|
|
|
|
|
|
|
HEADRequest('https://globo-ab.globo.com/v2/selected-alternatives?experiments=player-isolated-experiment-02&skipImpressions=true'),
|
|
|
|
|
|
|
|
video_id, 'Getting cookies')
|
|
|
|
|
|
|
|
|
|
|
|
video = self._download_json(
|
|
|
|
video = self._download_json(
|
|
|
|
'http://api.globovideos.com/videos/%s/playlist' % video_id,
|
|
|
|
'http://api.globovideos.com/videos/%s/playlist' % video_id,
|
|
|
|
video_id)['videos'][0]
|
|
|
|
video_id)['videos'][0]
|
|
|
@ -82,7 +100,7 @@ class GloboIE(InfoExtractor):
|
|
|
|
|
|
|
|
|
|
|
|
formats = []
|
|
|
|
formats = []
|
|
|
|
security = self._download_json(
|
|
|
|
security = self._download_json(
|
|
|
|
'https://playback.video.globo.com/v1/video-session', video_id, 'Downloading security hash for %s' % video_id,
|
|
|
|
'https://playback.video.globo.com/v2/video-session', video_id, 'Downloading security hash for %s' % video_id,
|
|
|
|
headers={'content-type': 'application/json'}, data=json.dumps({
|
|
|
|
headers={'content-type': 'application/json'}, data=json.dumps({
|
|
|
|
"player_type": "desktop",
|
|
|
|
"player_type": "desktop",
|
|
|
|
"video_id": video_id,
|
|
|
|
"video_id": video_id,
|
|
|
@ -92,7 +110,9 @@ class GloboIE(InfoExtractor):
|
|
|
|
"tz": "-3.0:00"
|
|
|
|
"tz": "-3.0:00"
|
|
|
|
}).encode())
|
|
|
|
}).encode())
|
|
|
|
|
|
|
|
|
|
|
|
security_hash = security['source']['token']
|
|
|
|
self._request_webpage(HEADRequest(security['sources'][0]['url_template']), video_id, 'Getting locksession cookie')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
security_hash = security['sources'][0]['token']
|
|
|
|
if not security_hash:
|
|
|
|
if not security_hash:
|
|
|
|
message = security.get('message')
|
|
|
|
message = security.get('message')
|
|
|
|
if message:
|
|
|
|
if message:
|
|
|
@ -115,7 +135,7 @@ class GloboIE(InfoExtractor):
|
|
|
|
md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()
|
|
|
|
md5_data = (received_md5 + padded_sign_time + '0xAC10FD').encode()
|
|
|
|
signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')
|
|
|
|
signed_md5 = base64.urlsafe_b64encode(hashlib.md5(md5_data).digest()).decode().strip('=')
|
|
|
|
signed_hash = hash_prefix + padded_sign_time + signed_md5
|
|
|
|
signed_hash = hash_prefix + padded_sign_time + signed_md5
|
|
|
|
source = security['source']['url_parts']
|
|
|
|
source = security['sources'][0]['url_parts']
|
|
|
|
resource_url = source['scheme'] + '://' + source['domain'] + source['path']
|
|
|
|
resource_url = source['scheme'] + '://' + source['domain'] + source['path']
|
|
|
|
signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')
|
|
|
|
signed_url = '%s?h=%s&k=html5&a=%s' % (resource_url, signed_hash, 'F' if video.get('subscriber_only') else 'A')
|
|
|
|
|
|
|
|
|
|
|
|