]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/space.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
6 from .brightcove
import BrightcoveIE
7 from ..utils
import RegexNotFoundError
, ExtractorError
10 class SpaceIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:(?:www|m)\.)?space\.com/\d+-(?P<title>[^/\.\?]*?)-video\.html'
13 'add_ie': ['Brightcove'],
14 'url': 'http://www.space.com/23373-huge-martian-landforms-detail-revealed-by-european-probe-video.html',
16 'id': '2780937028001',
18 'title': 'Huge Martian Landforms\' Detail Revealed By European Probe | Video',
19 'description': 'md5:db81cf7f3122f95ed234b631a6ea1e61',
20 'uploader': 'TechMedia Networks',
24 def _real_extract(self
, url
):
25 mobj
= re
.match(self
._VALID
_URL
, url
)
26 title
= mobj
.group('title')
27 webpage
= self
._download
_webpage
(url
, title
)
29 # Some videos require the playerKey field, which isn't define in
30 # the BrightcoveExperience object
31 brightcove_url
= self
._og
_search
_video
_url
(webpage
)
32 except RegexNotFoundError
:
33 # Other videos works fine with the info from the object
34 brightcove_url
= BrightcoveIE
._extract
_brightcove
_url
(webpage
)
35 if brightcove_url
is None:
36 raise ExtractorError(u
'The webpage does not contain a video', expected
=True)
37 return self
.url_result(brightcove_url
, BrightcoveIE
.ie_key())