3 from .common import InfoExtractor
6 class WorldStarHipHopIE(InfoExtractor):
7 _VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P<id>.*)'
9 "url": "http://www.worldstarhiphop.com/videos/video.php?v=wshh6a7q1ny0G34ZwuIO",
10 "file": "wshh6a7q1ny0G34ZwuIO.mp4",
11 "md5": "9d04de741161603bf7071bbf4e883186",
13 "title": "Video: KO Of The Week: MMA Fighter Gets Knocked Out By Swift Head Kick!"
18 def _real_extract(self, url):
19 m = re.match(self._VALID_URL, url)
20 video_id = m.group('id')
22 webpage_src = self._download_webpage(url, video_id)
24 video_url = re.search(r'videoId=(.*?)&?',
28 self.to_screen(u'Vevo video detected:')
29 return self.url_result('vevo:%s' % video_url.group(1), ie='Vevo')
31 video_url = self._search_regex(r'so\.addVariable\("file","(.*?)"\)',
32 webpage_src, u'video URL')
35 video_url = self._search_regex(r'videoId=(.*?)&?',
36 webpage_src, u'video URL')
37 self.to_screen(u'Vevo video detected:')
38 vevo_id = 'vevo:%s' % video_url
39 return self.url_result(vevo_id, ie='Vevo')
41 if 'youtube' in video_url:
42 self.to_screen(u'Youtube video detected:')
43 return self.url_result(video_url, ie='Youtube')
45 if 'mp4' in video_url:
50 video_title = self._html_search_regex(r"<title>(.*)</title>",
51 webpage_src, u'title')
53 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
54 thumbnail = self._html_search_regex(r'rel="image_src" href="(.*)" />',
55 webpage_src, u'thumbnail', fatal=False)
58 _title = r"""candytitles.*>(.*)</span>"""
59 mobj = re.search(_title, webpage_src)
61 video_title = mobj.group(1)
66 'title' : video_title,
67 'thumbnail' : thumbnail,