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": "KO Of The Week: MMA Fighter Gets Knocked Out By Swift Head Kick!"
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
24 m_vevo_id = re.search(r'videoId=(.*?)&?', webpage)
25 if m_vevo_id is not None:
26 return self.url_result('vevo:%s' % m_vevo_id.group(1), ie='Vevo')
28 video_url = self._search_regex(
29 r'so\.addVariable\("file","(.*?)"\)', webpage, 'video URL')
31 if 'youtube' in video_url:
32 return self.url_result(video_url, ie='Youtube')
34 video_title = self._html_search_regex(
35 r'(?s)<div class="content-heading">\s*<h1>(.*?)</h1>',
38 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
39 thumbnail = self._html_search_regex(
40 r'rel="image_src" href="(.*)" />', webpage, 'thumbnail',
43 _title = r'candytitles.*>(.*)</span>'
44 mobj = re.search(_title, webpage)
46 video_title = mobj.group(1)
52 'thumbnail': thumbnail,