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