]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/jukebox.py
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
13 class JukeboxIE(InfoExtractor
):
14 _VALID_URL
= r
'^http://www\.jukebox?\..+?\/.+[,](?P<video_id>[a-z0-9\-]+)\.html'
16 'url': 'http://www.jukebox.es/kosheen/videoclip,pride,r303r.html',
17 'md5': '1574e9b4d6438446d5b7dbcdf2786276',
21 'title': 'Kosheen-En Vivo Pride',
22 'uploader': 'Kosheen',
26 def _real_extract(self
, url
):
27 mobj
= re
.match(self
._VALID
_URL
, url
)
28 video_id
= mobj
.group('video_id')
30 html
= self
._download
_webpage
(url
, video_id
)
31 iframe_url
= unescapeHTML(self
._search
_regex
(r
'<iframe .*src="([^"]*)"', html
, 'iframe url'))
33 iframe_html
= self
._download
_webpage
(iframe_url
, video_id
, 'Downloading iframe')
34 if re
.search(r
'class="jkb_waiting"', iframe_html
) is not None:
35 raise ExtractorError('Video is not available(in your country?)!')
37 self
.report_extraction(video_id
)
40 video_url
= self
._search
_regex
(r
'"config":{"file":"(?P<video_url>http:[^"]+\?mdtk=[0-9]+)"',
41 iframe_html
, 'video url')
42 video_url
= unescapeHTML(video_url
).replace('\/', '/')
43 except RegexNotFoundError
:
44 youtube_url
= self
._search
_regex
(
45 r
'config":{"file":"(http:\\/\\/www\.youtube\.com\\/watch\?v=[^"]+)"',
46 iframe_html
, 'youtube url')
47 youtube_url
= unescapeHTML(youtube_url
).replace('\/', '/')
48 self
.to_screen('Youtube video detected')
49 return self
.url_result(youtube_url
, ie
='Youtube')
51 title
= self
._html
_search
_regex
(r
'<h1 class="inline">([^<]+)</h1>',
53 artist
= self
._html
_search
_regex
(r
'<span id="infos_article_artist">([^<]+)</span>',
59 'title': artist
+ '-' + title
,