]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/worldstarhiphop.py
4e89acd81bbb5ddfb97b1da3381b1b9f25873c96
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 class WorldStarHipHopIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P<id>.*)'
11 "url": "http://www.worldstarhiphop.com/videos/video.php?v=wshh6a7q1ny0G34ZwuIO",
12 "md5": "9d04de741161603bf7071bbf4e883186",
14 "id": "wshh6a7q1ny0G34ZwuIO",
16 "title": "Video: KO Of The Week: MMA Fighter Gets Knocked Out By Swift Head Kick!"
20 def _real_extract(self
, url
):
21 m
= re
.match(self
._VALID
_URL
, url
)
22 video_id
= m
.group('id')
24 webpage_src
= self
._download
_webpage
(url
, video_id
)
26 m_vevo_id
= re
.search(r
'videoId=(.*?)&?',
28 if m_vevo_id
is not None:
29 return self
.url_result('vevo:%s' % m_vevo_id
.group(1), ie
='Vevo')
31 video_url
= self
._search
_regex
(
32 r
'so\.addVariable\("file","(.*?)"\)', webpage_src
, 'video URL')
34 if 'youtube' in video_url
:
35 return self
.url_result(video_url
, ie
='Youtube')
37 video_title
= self
._html
_search
_regex
(
38 r
"<title>(.*)</title>", webpage_src
, 'title')
40 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
41 thumbnail
= self
._html
_search
_regex
(
42 r
'rel="image_src" href="(.*)" />', webpage_src
, 'thumbnail',
45 _title
= r
"""candytitles.*>(.*)</span>"""
46 mobj
= re
.search(_title
, webpage_src
)
48 video_title
= mobj
.group(1)
54 'thumbnail': thumbnail
,