1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-03 06:02:51 +08:00

Update discovery.py

This commit is contained in:
Sergey M 2019-01-02 23:45:39 +07:00 committed by GitHub
parent 2d869afc7e
commit 2b493e74a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ class DiscoveryIE(DiscoveryGoBaseIE):
def _real_extract(self, url): def _real_extract(self, url):
site, path, display_id = re.match(self._VALID_URL, url).groups() site, path, display_id = re.match(self._VALID_URL, url).groups()
webpage = self._download_webpage(url, display_id, headers=self.geo_verification_headers()) webpage = self._download_webpage(url, display_id)
react_data = self._parse_json(self._search_regex( react_data = self._parse_json(self._search_regex(
r'window\.__reactTransmitPacket\s*=\s*({.+?});', r'window\.__reactTransmitPacket\s*=\s*({.+?});',
@ -78,13 +78,11 @@ class DiscoveryIE(DiscoveryGoBaseIE):
compat_str) or '3020a40c2356a645b4b4', compat_str) or '3020a40c2356a645b4b4',
'nonce': ''.join([random.choice(string.ascii_letters) for _ in range(32)]), 'nonce': ''.join([random.choice(string.ascii_letters) for _ in range(32)]),
'redirectUri': 'https://fusion.ddmcdn.com/app/mercury-sdk/180/redirectHandler.html?https://www.%s.com' % site, 'redirectUri': 'https://fusion.ddmcdn.com/app/mercury-sdk/180/redirectHandler.html?https://www.%s.com' % site,
}, headers=self.geo_verification_headers())['access_token'] })['access_token']
try: try:
headers = self.geo_verification_headers() headers = self.geo_verification_headers()
headers.update({ headers['Authorization'] = 'Bearer ' + access_token
'Authorization': 'Bearer ' + access_token,
})
stream = self._download_json( stream = self._download_json(
'https://api.discovery.com/v1/streaming/video/' + video_id, 'https://api.discovery.com/v1/streaming/video/' + video_id,