]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/worldstarhiphop.py
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>.*)'
8 IE_NAME
= u
'WorldStarHipHop'
10 def _real_extract(self
, url
):
11 m
= re
.match(self
._VALID
_URL
, url
)
12 video_id
= m
.group('id')
14 webpage_src
= self
._download
_webpage
(url
, video_id
)
16 video_url
= self
._search
_regex
(r
'so\.addVariable\("file","(.*?)"\)',
17 webpage_src
, u
'video URL')
19 if 'youtube' in video_url
:
20 self
.to_screen(u
'Youtube video detected:')
21 return self
.url_result(video_url
, ie
='Youtube')
23 if 'mp4' in video_url
:
28 video_title
= self
._html
_search
_regex
(r
"<title>(.*)</title>",
29 webpage_src
, u
'title')
31 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
32 thumbnail
= self
._html
_search
_regex
(r
'rel="image_src" href="(.*)" />',
33 webpage_src
, u
'thumbnail', fatal
=False)
36 _title
= r
"""candytitles.*>(.*)</span>"""
37 mobj
= re
.search(_title
, webpage_src
)
39 video_title
= mobj
.group(1)
44 'title' : video_title
,
45 'thumbnail' : thumbnail
,