1 from __future__ import unicode_literals
3 from .common import InfoExtractor
11 class NationalGeographicIE(InfoExtractor):
13 _VALID_URL = r'https?://video\.nationalgeographic\.com/.*?'
17 'url': 'http://video.nationalgeographic.com/video/news/150210-news-crab-mating-vin?source=featuredvideo',
18 'md5': '730855d559abbad6b42c2be1fa584917',
20 'id': '0000014b-70a1-dd8c-af7f-f7b559330001',
22 'title': 'Mating Crabs Busted by Sharks',
23 'description': 'md5:16f25aeffdeba55aaa8ec37e093ad8b3',
25 'add_ie': ['ThePlatform'],
28 'url': 'http://video.nationalgeographic.com/wild/when-sharks-attack/the-real-jaws',
29 'md5': '6a3105eb448c070503b3105fb9b320b5',
31 'id': 'ngc-I0IauNSWznb_UV008GxSbwY35BZvgi2e',
33 'title': 'The Real Jaws',
34 'description': 'md5:8d3e09d9d53a85cd397b4b21b2c77be6',
36 'add_ie': ['ThePlatform'],
40 def _real_extract(self, url):
41 name = url_basename(url)
43 webpage = self._download_webpage(url, name)
44 guid = self._search_regex(
45 r'id="(?:videoPlayer|player-container)"[^>]+data-guid="([^"]+)"',
49 '_type': 'url_transparent',
50 'ie_key': 'ThePlatform',
52 'http://link.theplatform.com/s/ngs/media/guid/2423130747/%s?mbr=true' % guid,
53 {'force_smil_url': True}),
58 class NationalGeographicChannelIE(InfoExtractor):
59 IE_NAME = 'natgeo:channel'
60 _VALID_URL = r'https?://channel\.nationalgeographic\.com/(?:wild/)?[^/]+/videos/(?P<id>[^/?]+)'
64 'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/',
65 'md5': '518c9aa655686cf81493af5cc21e2a04',
69 'title': 'Uncovering a Universal Knowledge',
70 'description': 'md5:1a89148475bf931b3661fcd6ddb2ae3a',
72 'add_ie': ['ThePlatform'],
75 'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/',
76 'md5': 'c4912f656b4cbe58f3e000c489360989',
80 'title': 'The Stunning Red Bird of Paradise',
81 'description': 'md5:7bc8cd1da29686be4d17ad1230f0140c',
83 'add_ie': ['ThePlatform'],
87 def _real_extract(self, url):
88 display_id = self._match_id(url)
89 webpage = self._download_webpage(url, display_id)
90 release_url = self._search_regex(
91 r'video_auth_playlist_url\s*=\s*"([^"]+)"',
92 webpage, 'release url')
95 '_type': 'url_transparent',
96 'ie_key': 'ThePlatform',
98 update_url_query(release_url, {'mbr': 'true', 'switch': 'http'}),
99 {'force_smil_url': True}),
100 'display_id': display_id,