]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/scivee.py
Prepare for upload.
[youtubedl] / youtube_dl / extractor / scivee.py
1 from __future__ import unicode_literals
2
3 import re
4
5 from .common import InfoExtractor
6 from ..utils import int_or_none
7
8
9 class 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',
14 'md5': 'b16699b74c9e6a120f6772a44960304f',
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',
20 },
21 'skip': 'Not accessible from Travis CI server',
22 }
23
24 def _real_extract(self, url):
25 mobj = re.match(self._VALID_URL, url)
26 video_id = mobj.group('id')
27
28 # annotations XML is malformed
29 annotations = self._download_webpage(
30 'http://www.scivee.tv/assets/annotations/%s' % video_id, video_id, 'Downloading annotations')
31
32 title = self._html_search_regex(r'<title>([^<]+)</title>', annotations, 'title')
33 description = self._html_search_regex(r'<abstract>([^<]+)</abstract>', annotations, 'abstract', fatal=False)
34 filesize = int_or_none(self._html_search_regex(
35 r'<filesize>([^<]+)</filesize>', annotations, 'filesize', fatal=False))
36
37 formats = [
38 {
39 'url': 'http://www.scivee.tv/assets/audio/%s' % video_id,
40 'ext': 'mp3',
41 'format_id': 'audio',
42 },
43 {
44 'url': 'http://www.scivee.tv/assets/video/%s' % video_id,
45 'ext': 'mp4',
46 'format_id': 'video',
47 'filesize': filesize,
48 },
49 ]
50
51 return {
52 'id': video_id,
53 'title': title,
54 'description': description,
55 'thumbnail': 'http://www.scivee.tv/assets/videothumb/%s' % video_id,
56 'formats': formats,
57 }