]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nationalgeographic.py
c18640c5a9f0093344475ad649643705522cddb9
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class NationalGeographicIE(InfoExtractor
):
11 _VALID_URL
= r
'http://video\.nationalgeographic\.com/video/.*?'
14 'url': 'http://video.nationalgeographic.com/video/news/150210-news-crab-mating-vin?source=featuredvideo',
18 'title': 'Mating Crabs Busted by Sharks',
19 'description': 'md5:16f25aeffdeba55aaa8ec37e093ad8b3',
21 'add_ie': ['ThePlatform'],
24 def _real_extract(self
, url
):
25 name
= url_basename(url
)
27 webpage
= self
._download
_webpage
(url
, name
)
28 feed_url
= self
._search
_regex
(r
'data-feed-url="([^"]+)"', webpage
, 'feed url')
29 guid
= self
._search
_regex
(r
'data-video-guid="([^"]+)"', webpage
, 'guid')
31 feed
= self
._download
_xml
('%s?byGuid=%s' % (feed_url
, guid
), name
)
32 content
= feed
.find('.//{http://search.yahoo.com/mrss/}content')
33 theplatform_id
= url_basename(content
.attrib
.get('url'))
35 return self
.url_result(smuggle_url(
36 'http://link.theplatform.com/s/ngs/%s?format=SMIL&formats=MPEG4&manifest=f4m' % theplatform_id
,
37 # For some reason, the normal links don't work and we must force the use of f4m
38 {'force_smil_url': True}))