]>
Commit | Line | Data |
---|---|---|
c9aa111b PH |
1 | from __future__ import unicode_literals |
2 | ||
250f5578 PH |
3 | from .common import InfoExtractor |
4 | ||
5 | ||
6 | class WorldStarHipHopIE(InfoExtractor): | |
f8f2da25 | 7 | _VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/(?:videos|android)/video\.php\?.*?\bv=(?P<id>[^&]+)' |
fa6a1699 | 8 | _TESTS = [{ |
611c1dd9 S |
9 | 'url': 'http://www.worldstarhiphop.com/videos/video.php?v=wshh6a7q1ny0G34ZwuIO', |
10 | 'md5': '9d04de741161603bf7071bbf4e883186', | |
11 | 'info_dict': { | |
12 | 'id': 'wshh6a7q1ny0G34ZwuIO', | |
13 | 'ext': 'mp4', | |
14 | 'title': 'KO Of The Week: MMA Fighter Gets Knocked Out By Swift Head Kick!' | |
6b47c7f2 | 15 | } |
fa6a1699 YCH |
16 | }, { |
17 | 'url': 'http://m.worldstarhiphop.com/android/video.php?v=wshh6a7q1ny0G34ZwuIO', | |
f8f2da25 | 18 | 'only_matching': True, |
fa6a1699 | 19 | }] |
6b47c7f2 | 20 | |
250f5578 | 21 | def _real_extract(self, url): |
12548cd9 PH |
22 | video_id = self._match_id(url) |
23 | webpage = self._download_webpage(url, video_id) | |
250f5578 | 24 | |
f8f2da25 | 25 | entries = self._parse_html5_media_entries(url, webpage, video_id) |
250f5578 | 26 | |
f8f2da25 S |
27 | if not entries: |
28 | return self.url_result(url, 'Generic') | |
d18596ba | 29 | |
f8f2da25 | 30 | title = self._html_search_regex( |
fa6a1699 YCH |
31 | [r'(?s)<div class="content-heading">\s*<h1>(.*?)</h1>', |
32 | r'<span[^>]+class="tc-sp-pinned-title">(.*)</span>'], | |
12548cd9 | 33 | webpage, 'title') |
250f5578 | 34 | |
f8f2da25 S |
35 | info = entries[0] |
36 | info.update({ | |
c9aa111b | 37 | 'id': video_id, |
f8f2da25 S |
38 | 'title': title, |
39 | }) | |
40 | return info |