From: Sergey M․ Date: Sat, 26 Apr 2014 13:22:15 +0000 (+0700) Subject: [scivee] Add support for scivee.tv X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=7c360e3a04f09b912f51034c7778eb2297872e86;p=youtube-dl [scivee] Add support for scivee.tv --- diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 9a0983e17..e389acc6a 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -221,6 +221,7 @@ from .rutube import ( ) from .rutv import RUTVIE from .savefrom import SaveFromIE +from .scivee import SciVeeIE from .servingsys import ServingSysIE from .sina import SinaIE from .slideshare import SlideshareIE diff --git a/youtube_dl/extractor/scivee.py b/youtube_dl/extractor/scivee.py new file mode 100644 index 000000000..609a5ec99 --- /dev/null +++ b/youtube_dl/extractor/scivee.py @@ -0,0 +1,56 @@ +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import int_or_none + + +class SciVeeIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?scivee\.tv/node/(?P\d+)' + + _TEST = { + 'url': 'http://www.scivee.tv/node/62352', + 'md5': 'b16699b74c9e6a120f6772a44960304f', + 'info_dict': { + 'id': '62352', + 'ext': 'mp4', + 'title': 'Adam Arkin at the 2014 DOE JGI Genomics of Energy & Environment Meeting', + 'description': 'md5:81f1710638e11a481358fab1b11059d7', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + # annotations XML is malformed + annotations = self._download_webpage( + 'http://www.scivee.tv/assets/annotations/%s' % video_id, video_id, 'Downloading annotations') + + title = self._html_search_regex(r'([^<]+)', annotations, 'title') + description = self._html_search_regex(r'([^<]+)', annotations, 'abstract', fatal=False) + filesize = int_or_none(self._html_search_regex( + r'([^<]+)', annotations, 'filesize', fatal=False)) + + formats = [ + { + 'url': 'http://www.scivee.tv/assets/audio/%s' % video_id, + 'ext': 'mp3', + 'format_id': 'audio', + }, + { + 'url': 'http://www.scivee.tv/assets/video/%s' % video_id, + 'ext': 'mp4', + 'format_id': 'video', + 'filesize': filesize, + }, + ] + + return { + 'id': video_id, + 'title': title, + 'description': description, + 'thumbnail': 'http://www.scivee.tv/assets/videothumb/%s' % video_id, + 'formats': formats, + } \ No newline at end of file