]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/viidea.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
18 class ViideaIE(InfoExtractor
):
19 _VALID_URL
= r
'''(?x)http://(?:www\.)?(?:
21 flexilearn\.viidea\.net|
22 presentations\.ocwconsortium\.org|
23 video\.travel-zoom\.si|
24 video\.pomp-forum\.si|
30 video\.kiberpipa\.org|
33 edemokracija\.viidea\.com
34 )(?:/lecture)?/(?P<id>[^/]+)(?:/video/(?P<part>\d+))?'''
37 'url': 'http://videolectures.net/promogram_igor_mekjavic_eng/',
41 'title': 'Automatics, robotics and biocybernetics',
42 'description': 'md5:815fc1deb6b3a2bff99de2d5325be482',
43 'upload_date': '20130627',
45 'thumbnail': 're:http://.*\.jpg',
48 # video with invalid direct format links (HTTP 403)
49 'url': 'http://videolectures.net/russir2010_filippova_nlp/',
53 'title': 'NLP at Google',
54 'description': 'md5:fc7a6d9bf0302d7cc0e53f7ca23747b3',
56 'thumbnail': 're:http://.*\.jpg',
60 'skip_download': True,
63 'url': 'http://videolectures.net/deeplearning2015_montreal/',
66 'title': 'Deep Learning Summer School, Montreal 2015',
67 'description': 'md5:0533a85e4bd918df52a01f0e1ebe87b7',
68 'timestamp': 1438560000,
73 'url': 'http://videolectures.net/mlss09uk_bishop_ibi/',
76 'title': 'Introduction To Bayesian Inference',
77 'timestamp': 1251622800,
83 'title': 'Introduction To Bayesian Inference',
89 'title': 'Introduction To Bayesian Inference',
95 def _real_extract(self
, url
):
96 lecture_slug
, part
= re
.match(self
._VALID
_URL
, url
).groups()
98 webpage
= self
._download
_webpage
(url
, lecture_slug
)
100 cfg
= self
._parse
_json
(self
._search
_regex
(r
'cfg\s*:\s*({[^}]+})', webpage
, 'cfg'), lecture_slug
, js_to_json
)
102 lecture_id
= str(cfg
['obj_id'])
104 base_url
= self
._proto
_relative
_url
(cfg
['livepipe'], 'http:')
106 lecture_data
= self
._download
_json
('%s/site/api/lecture/%s?format=json' % (base_url
, lecture_id
), lecture_id
)['lecture'][0]
110 'display_id': lecture_slug
,
111 'title': lecture_data
['title'],
112 'timestamp': parse_iso8601(lecture_data
.get('time')),
113 'description': lecture_data
.get('description_wiki'),
114 'thumbnail': lecture_data
.get('thumb'),
118 parts
= cfg
.get('videos')
123 smil_url
= '%s/%s/video/%s/smil.xml' % (base_url
, lecture_slug
, part
)
124 smil
= self
._download
_smil
(smil_url
, lecture_id
)
125 info
= self
._parse
_smil
(smil
, smil_url
, lecture_id
)
126 info
['id'] = '%s_part%s' % (lecture_id
, part
)
127 switch
= smil
.find('.//switch')
128 if switch
is not None:
129 info
['duration'] = parse_duration(switch
.attrib
.get('dur'))
133 entries
.append(self
.url_result('%s/video/%s' % (base_url
, lecture_id
, part
), 'Viidea'))
134 lecture_info
['_type'] = 'multi_video'
136 # Probably a playlist
137 playlist_webpage
= self
._download
_webpage
('%s/site/ajax/drilldown/?id=%s' % (base_url
, lecture_id
), lecture_id
)
139 self
.url_result(compat_urlparse
.urljoin(url
, video_url
), 'Viidea')
140 for _
, video_url
in re
.findall(r
'<a[^>]+href=(["\'])(.+?
)\
1[^
>]+id=["\']lec=\d+', playlist_webpage)]
141 lecture_info['_type'] = 'playlist'
143 lecture_info['entries'] = entries