]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/videolecturesnet.py
d6a7eb2033e58a92df09be6c042c91d6e932f8b7
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
14 class VideoLecturesNetIE(InfoExtractor
):
15 _VALID_URL
= r
'http://(?:www\.)?videolectures\.net/(?P<id>[^/#?]+)/'
16 IE_NAME
= 'videolectures.net'
19 'url': 'http://videolectures.net/promogram_igor_mekjavic_eng/',
21 'id': 'promogram_igor_mekjavic_eng',
23 'title': 'Automatics, robotics and biocybernetics',
24 'description': 'md5:815fc1deb6b3a2bff99de2d5325be482',
25 'upload_date': '20130627',
27 'thumbnail': 're:http://.*\.jpg',
31 def _real_extract(self
, url
):
32 mobj
= re
.match(self
._VALID
_URL
, url
)
33 video_id
= mobj
.group('id')
35 smil_url
= 'http://videolectures.net/%s/video/1/smil.xml' % video_id
36 smil
= self
._download
_xml
(smil_url
, video_id
)
38 title
= find_xpath_attr(smil
, './/meta', 'name', 'title').attrib
['content']
39 description_el
= find_xpath_attr(smil
, './/meta', 'name', 'abstract')
41 None if description_el
is None
42 else description_el
.attrib
['content'])
43 upload_date
= unified_strdate(
44 find_xpath_attr(smil
, './/meta', 'name', 'date').attrib
['content'])
46 switch
= smil
.find('.//switch')
47 duration
= parse_duration(switch
.attrib
.get('dur'))
48 thumbnail_el
= find_xpath_attr(switch
, './image', 'type', 'thumbnail')
50 None if thumbnail_el
is None else thumbnail_el
.attrib
.get('src'))
53 for v
in switch
.findall('./video'):
54 proto
= v
.attrib
.get('proto')
55 if proto
not in ['http', 'rtmp']:
58 'width': int_or_none(v
.attrib
.get('width')),
59 'height': int_or_none(v
.attrib
.get('height')),
60 'filesize': int_or_none(v
.attrib
.get('size')),
61 'tbr': int_or_none(v
.attrib
.get('systemBitrate')) / 1000.0,
62 'ext': v
.attrib
.get('ext'),
66 if self
._is
_valid
_url
(src
, video_id
):
71 'url': v
.attrib
['streamer'],
73 'rtmp_real_time': True,
76 self
._sort
_formats
(formats
)
81 'description': description
,
82 'upload_date': upload_date
,
84 'thumbnail': thumbnail
,