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