aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/space.py
diff options
context:
space:
mode:
authorrzhxeo <rzhxeot7z81b4700@mailcatch.com>2013-11-18 00:27:06 +0100
committerrzhxeo <rzhxeot7z81b4700@mailcatch.com>2013-11-18 00:27:06 +0100
commit2b35c9ef742bf261078ea10c6c0bba848db1a0df (patch)
treefe80c838c7529c8cab6f1b44d730a2849cd68c48 /youtube_dl/extractor/space.py
parent4894fe8c5baec8b1f21ac6fdebe08175abc7f094 (diff)
parent73c566695fac926e7e9e6922fe4e6d82c64a1850 (diff)
Merge branch 'master' into rtmpdump
Conflicts: youtube_dl/FileDownloader.py Merge
Diffstat (limited to 'youtube_dl/extractor/space.py')
-rw-r--r--youtube_dl/extractor/space.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/youtube_dl/extractor/space.py b/youtube_dl/extractor/space.py
new file mode 100644
index 000000000..0d32a0688
--- /dev/null
+++ b/youtube_dl/extractor/space.py
@@ -0,0 +1,35 @@
+import re
+
+from .common import InfoExtractor
+from .brightcove import BrightcoveIE
+from ..utils import RegexNotFoundError, ExtractorError
+
+
+class SpaceIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.space\.com/\d+-(?P<title>[^/\.\?]*?)-video.html'
+ _TEST = {
+ u'add_ie': ['Brightcove'],
+ u'url': u'http://www.space.com/23373-huge-martian-landforms-detail-revealed-by-european-probe-video.html',
+ u'info_dict': {
+ u'id': u'2780937028001',
+ u'ext': u'mp4',
+ u'title': u'Huge Martian Landforms\' Detail Revealed By European Probe | Video',
+ u'description': u'md5:db81cf7f3122f95ed234b631a6ea1e61',
+ u'uploader': u'TechMedia Networks',
+ },
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ title = mobj.group('title')
+ webpage = self._download_webpage(url, title)
+ try:
+ # Some videos require the playerKey field, which isn't define in
+ # the BrightcoveExperience object
+ brightcove_url = self._og_search_video_url(webpage)
+ except RegexNotFoundError:
+ # Other videos works fine with the info from the object
+ brightcove_url = BrightcoveIE._extract_brightcove_url(webpage)
+ if brightcove_url is None:
+ raise ExtractorError(u'The webpage does not contain a video', expected=True)
+ return self.url_result(brightcove_url, BrightcoveIE.ie_key())