]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/scivee.py
release 2014.04.30.1
[yt-dlp.git] / youtube_dl / extractor / scivee.py
CommitLineData
7c360e3a
S
1from __future__ import unicode_literals
2
3import re
4
5from .common import InfoExtractor
6from ..utils import int_or_none
7
8
9class SciVeeIE(InfoExtractor):
10 _VALID_URL = r'https?://(?:www\.)?scivee\.tv/node/(?P<id>\d+)'
11
12 _TEST = {
13 'url': 'http://www.scivee.tv/node/62352',
8a7a4a97 14 #'md5': 'b16699b74c9e6a120f6772a44960304f',
7c360e3a
S
15 'info_dict': {
16 'id': '62352',
17 'ext': 'mp4',
18 'title': 'Adam Arkin at the 2014 DOE JGI Genomics of Energy & Environment Meeting',
19 'description': 'md5:81f1710638e11a481358fab1b11059d7',
8a7a4a97
S
20 },
21 'params': {
22 # Range HTTP header is ignored
23 'skip_download': True,
24 },
7c360e3a
S
25 }
26
27 def _real_extract(self, url):
28 mobj = re.match(self._VALID_URL, url)
29 video_id = mobj.group('id')
30
31 # annotations XML is malformed
32 annotations = self._download_webpage(
33 'http://www.scivee.tv/assets/annotations/%s' % video_id, video_id, 'Downloading annotations')
34
35 title = self._html_search_regex(r'<title>([^<]+)</title>', annotations, 'title')
36 description = self._html_search_regex(r'<abstract>([^<]+)</abstract>', annotations, 'abstract', fatal=False)
37 filesize = int_or_none(self._html_search_regex(
38 r'<filesize>([^<]+)</filesize>', annotations, 'filesize', fatal=False))
39
40 formats = [
41 {
42 'url': 'http://www.scivee.tv/assets/audio/%s' % video_id,
43 'ext': 'mp3',
44 'format_id': 'audio',
45 },
46 {
47 'url': 'http://www.scivee.tv/assets/video/%s' % video_id,
48 'ext': 'mp4',
49 'format_id': 'video',
50 'filesize': filesize,
51 },
52 ]
53
54 return {
55 'id': video_id,
56 'title': title,
57 'description': description,
58 'thumbnail': 'http://www.scivee.tv/assets/videothumb/%s' % video_id,
59 'formats': formats,
60 }