Skip to content

Commit

Permalink
[nationalgeographic] add support Adobe Pass auth
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Jul 2, 2016
1 parent 05c7fee commit a1f6f5c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions youtube_dl/extractor/nationalgeographic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import unicode_literals

from .common import InfoExtractor
from .theplatform import ThePlatformIE
from ..utils import (
smuggle_url,
url_basename,
Expand Down Expand Up @@ -61,7 +62,7 @@ def _real_extract(self, url):
}


class NationalGeographicChannelIE(InfoExtractor):
class NationalGeographicChannelIE(ThePlatformIE):
IE_NAME = 'natgeo:channel'
_VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:wild/)?[^/]+/videos/(?P<id>[^/?]+)'

Expand Down Expand Up @@ -102,12 +103,22 @@ def _real_extract(self, url):
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,
}

0 comments on commit a1f6f5c

Please sign in to comment.