1 from __future__ import unicode_literals
3 from .common import InfoExtractor
4 from .theplatform import ThePlatformIE
12 class NationalGeographicIE(InfoExtractor):
14 _VALID_URL = r'https?://video\.nationalgeographic\.com/.*?'
18 'url': 'http://video.nationalgeographic.com/video/news/150210-news-crab-mating-vin?source=featuredvideo',
19 'md5': '730855d559abbad6b42c2be1fa584917',
21 'id': '0000014b-70a1-dd8c-af7f-f7b559330001',
23 'title': 'Mating Crabs Busted by Sharks',
24 'description': 'md5:16f25aeffdeba55aaa8ec37e093ad8b3',
25 'timestamp': 1423523799,
26 'upload_date': '20150209',
29 'add_ie': ['ThePlatform'],
32 'url': 'http://video.nationalgeographic.com/wild/when-sharks-attack/the-real-jaws',
33 'md5': '6a3105eb448c070503b3105fb9b320b5',
35 'id': 'ngc-I0IauNSWznb_UV008GxSbwY35BZvgi2e',
37 'title': 'The Real Jaws',
38 'description': 'md5:8d3e09d9d53a85cd397b4b21b2c77be6',
39 'timestamp': 1433772632,
40 'upload_date': '20150608',
43 'add_ie': ['ThePlatform'],
47 def _real_extract(self, url):
48 name = url_basename(url)
50 webpage = self._download_webpage(url, name)
51 guid = self._search_regex(
52 r'id="(?:videoPlayer|player-container)"[^>]+data-guid="([^"]+)"',
56 '_type': 'url_transparent',
57 'ie_key': 'ThePlatform',
59 'http://link.theplatform.com/s/ngs/media/guid/2423130747/%s?mbr=true' % guid,
60 {'force_smil_url': True}),
65 class NationalGeographicChannelIE(ThePlatformIE):
66 IE_NAME = 'natgeo:channel'
67 _VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:wild/)?[^/]+/videos/(?P<id>[^/?]+)'
71 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/',
72 'md5': '518c9aa655686cf81493af5cc21e2a04',
76 'title': 'Uncovering a Universal Knowledge',
77 'description': 'md5:1a89148475bf931b3661fcd6ddb2ae3a',
78 'timestamp': 1458680907,
79 'upload_date': '20160322',
80 'uploader': 'NEWA-FNG-NGTV',
82 'add_ie': ['ThePlatform'],
85 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/',
86 'md5': 'c4912f656b4cbe58f3e000c489360989',
90 'title': 'The Stunning Red Bird of Paradise',
91 'description': 'md5:7bc8cd1da29686be4d17ad1230f0140c',
92 'timestamp': 1459362152,
93 'upload_date': '20160330',
94 'uploader': 'NEWA-FNG-NGTV',
96 'add_ie': ['ThePlatform'],
100 def _real_extract(self, url):
101 display_id = self._match_id(url)
102 webpage = self._download_webpage(url, display_id)
103 release_url = self._search_regex(
104 r'video_auth_playlist_url\s*=\s*"([^"]+)"',
105 webpage, 'release url')
110 is_auth = self._search_regex(r'video_is_auth\s*=\s*"([^"]+)"', webpage, 'is auth', fatal=False)
111 if is_auth == 'auth':
112 auth_resource_id = self._search_regex(
113 r"video_auth_resourceId\s*=\s*'([^']+)'",
114 webpage, 'auth resource id')
115 query['auth'] = self._extract_mvpd_auth(url, display_id, 'natgeo', auth_resource_id) or ''
118 '_type': 'url_transparent',
119 'ie_key': 'ThePlatform',
121 update_url_query(release_url, query),
122 {'force_smil_url': True}),
123 'display_id': display_id,