]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nationalgeographic.py
72251866303885f6cd9b040ec9ad3f042d8add6a
   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', 
  24                 'timestamp': 1423523799, 
  25                 'upload_date': '20150209', 
  28             'add_ie': ['ThePlatform'], 
  31             'url': 'http://video.nationalgeographic.com/wild/when-sharks-attack/the-real-jaws', 
  32             'md5': '6a3105eb448c070503b3105fb9b320b5', 
  34                 'id': 'ngc-I0IauNSWznb_UV008GxSbwY35BZvgi2e', 
  36                 'title': 'The Real Jaws', 
  37                 'description': 'md5:8d3e09d9d53a85cd397b4b21b2c77be6', 
  38                 'timestamp': 1433772632, 
  39                 'upload_date': '20150608', 
  42             'add_ie': ['ThePlatform'], 
  46     def _real_extract(self
, url
): 
  47         name 
= url_basename(url
) 
  49         webpage 
= self
._download
_webpage
(url
, name
) 
  50         guid 
= self
._search
_regex
( 
  51             r
'id="(?:videoPlayer|player-container)"[^>]+data-guid="([^"]+)"', 
  55             '_type': 'url_transparent', 
  56             'ie_key': 'ThePlatform', 
  58                 'http://link.theplatform.com/s/ngs/media/guid/2423130747/%s?mbr=true' % guid
, 
  59                 {'force_smil_url': True}), 
  64 class NationalGeographicChannelIE(InfoExtractor
): 
  65     IE_NAME 
= 'natgeo:channel' 
  66     _VALID_URL 
= r
'https?://channel\.nationalgeographic\.com/(?:wild/)?[^/]+/videos/(?P<id>[^/?]+)' 
  70             'url': 'http://channel.nationalgeographic.com/the-story-of-god-with-morgan-freeman/videos/uncovering-a-universal-knowledge/', 
  71             'md5': '518c9aa655686cf81493af5cc21e2a04', 
  75                 'title': 'Uncovering a Universal Knowledge', 
  76                 'description': 'md5:1a89148475bf931b3661fcd6ddb2ae3a', 
  77                 'timestamp': 1458680907, 
  78                 'upload_date': '20160322', 
  79                 'uploader': 'NEWA-FNG-NGTV', 
  81             'add_ie': ['ThePlatform'], 
  84             'url': 'http://channel.nationalgeographic.com/wild/destination-wild/videos/the-stunning-red-bird-of-paradise/', 
  85             'md5': 'c4912f656b4cbe58f3e000c489360989', 
  89                 'title': 'The Stunning Red Bird of Paradise', 
  90                 'description': 'md5:7bc8cd1da29686be4d17ad1230f0140c', 
  91                 'timestamp': 1459362152, 
  92                 'upload_date': '20160330', 
  93                 'uploader': 'NEWA-FNG-NGTV', 
  95             'add_ie': ['ThePlatform'], 
  99     def _real_extract(self
, url
): 
 100         display_id 
= self
._match
_id
(url
) 
 101         webpage 
= self
._download
_webpage
(url
, display_id
) 
 102         release_url 
= self
._search
_regex
( 
 103             r
'video_auth_playlist_url\s*=\s*"([^"]+)"', 
 104             webpage
, 'release url') 
 107             '_type': 'url_transparent', 
 108             'ie_key': 'ThePlatform', 
 110                 update_url_query(release_url
, {'mbr': 'true', 'switch': 'http'}), 
 111                 {'force_smil_url': True}), 
 112             'display_id': display_id
,