]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/worldstarhiphop.py
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|android)/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!"
19 'url': 'http://m.worldstarhiphop.com/android/video.php?v=wshh6a7q1ny0G34ZwuIO',
20 'md5': 'dc1c76c83ecc4190bb1eb143899b87d3',
22 'id': 'wshh6a7q1ny0G34ZwuIO',
24 "title": "KO Of The Week: MMA Fighter Gets Knocked Out By Swift Head Kick!"
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 webpage
= self
._download
_webpage
(url
, video_id
)
32 m_vevo_id
= re
.search(r
'videoId=(.*?)&?', webpage
)
33 if m_vevo_id
is not None:
34 return self
.url_result('vevo:%s' % m_vevo_id
.group(1), ie
='Vevo')
36 video_url
= self
._search
_regex
(
37 [r
'so\.addVariable\("file","(.*?)"\)',
38 r
'<div class="artlist">\s*<a[^>]+href="([^"]+)">'],
41 if 'youtube' in video_url
:
42 return self
.url_result(video_url
, ie
='Youtube')
44 video_title
= self
._html
_search
_regex
(
45 [r
'(?s)<div class="content-heading">\s*<h1>(.*?)</h1>',
46 r
'<span[^>]+class="tc-sp-pinned-title">(.*)</span>'],
49 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
50 thumbnail
= self
._html
_search
_regex
(
51 r
'rel="image_src" href="(.*)" />', webpage
, 'thumbnail',
54 _title
= r
'candytitles.*>(.*)</span>'
55 mobj
= re
.search(_title
, webpage
)
57 video_title
= mobj
.group(1)
63 'thumbnail': thumbnail
,