about summary refs log tree commit diff
path: root/youtube_dl/extractor/nationalgeographic.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-07-02 21:22:08 +0100
committerRemita Amine <remitamine@gmail.com>2016-07-02 21:24:22 +0100
commita1f6f5c768a506674928530990b7f95c605eac2c (patch)
tree05a54f9407c297496de7f57d2ac142e6c6f93318 /youtube_dl/extractor/nationalgeographic.py
parent05c7feec77f42145815695943d24cb6a9d7c7baa (diff)
downloadyoutube-dl-a1f6f5c768a506674928530990b7f95c605eac2c.tar.gz
youtube-dl-a1f6f5c768a506674928530990b7f95c605eac2c.tar.xz
youtube-dl-a1f6f5c768a506674928530990b7f95c605eac2c.zip
[nationalgeographic] add support Adobe Pass auth
Diffstat (limited to 'youtube_dl/extractor/nationalgeographic.py')
-rw-r--r--youtube_dl/extractor/nationalgeographic.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/youtube_dl/extractor/nationalgeographic.py b/youtube_dl/extractor/nationalgeographic.py
index 722518663..ed76798aa 100644
--- a/youtube_dl/extractor/nationalgeographic.py
+++ b/youtube_dl/extractor/nationalgeographic.py
@@ -1,6 +1,7 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
+from .theplatform import ThePlatformIE
 from ..utils import (
     smuggle_url,
     url_basename,
@@ -61,7 +62,7 @@ class NationalGeographicIE(InfoExtractor):
         }
 
 
-class NationalGeographicChannelIE(InfoExtractor):
+class NationalGeographicChannelIE(ThePlatformIE):
     IE_NAME = 'natgeo:channel'
     _VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:wild/)?[^/]+/videos/(?P<id>[^/?]+)'
 
@@ -102,12 +103,22 @@ class NationalGeographicChannelIE(InfoExtractor):
         release_url = self._search_regex(
             r'video_auth_playlist_url\s*=\s*"([^"]+)"',
             webpage, 'release url')
+        query = {
+            'mbr': 'true',
+            'manifest': 'm3u',
+        }
+        is_auth = self._search_regex(r'video_is_auth\s*=\s*"([^"]+)"', webpage, 'is auth', fatal=False)
+        if is_auth == 'auth':
+            auth_resource_id = self._search_regex(
+                r"video_auth_resourceId\s*=\s*'([^']+)'",
+                webpage, 'auth resource id')
+            query['auth'] = self._extract_mvpd_auth(url, display_id, 'natgeo', auth_resource_id) or ''
 
         return {
             '_type': 'url_transparent',
             'ie_key': 'ThePlatform',
             'url': smuggle_url(
-                update_url_query(release_url, {'mbr': 'true', 'switch': 'http'}),
+                update_url_query(release_url, query),
                 {'force_smil_url': True}),
             'display_id': display_id,
         }