[discovery] Use geo verification headers
authornyuszika7h <nyuszika7h@gmail.com>
Wed, 2 Jan 2019 16:46:07 +0000 (17:46 +0100)
committerSergey M <dstftw@gmail.com>
Wed, 2 Jan 2019 16:46:07 +0000 (23:46 +0700)
youtube_dl/extractor/discovery.py

index 44fbc41bb6729849a9531f4bb0f148b196742a07..b70c307a75b520aa63e44fea69762cacc6bbc319 100644 (file)
@@ -94,11 +94,12 @@ class DiscoveryIE(DiscoveryGoBaseIE):
                 })['access_token']
 
         try:
+            headers = self.geo_verification_headers()
+            headers['Authorization'] = 'Bearer ' + access_token
+
             stream = self._download_json(
                 'https://api.discovery.com/v1/streaming/video/' + video_id,
-                display_id, headers={
-                    'Authorization': 'Bearer ' + access_token,
-                })
+                display_id, headers=headers)
         except ExtractorError as e:
             if isinstance(e.cause, compat_HTTPError) and e.cause.code in (401, 403):
                 e_description = self._parse_json(