]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/worldstarhiphop.py
54a77b69699439a3409280cdab7cbbac5b743069
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 'mp4' in video_url
:
24 video_title
= self
._html
_search
_regex
(r
"<title>(.*)</title>",
25 webpage_src
, u
'title')
27 # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
28 thumbnail
= self
._html
_search
_regex
(r
'rel="image_src" href="(.*)" />',
29 webpage_src
, u
'thumbnail', fatal
=False)
32 _title
= r
"""candytitles.*>(.*)</span>"""
33 mobj
= re
.search(_title
, webpage_src
)
35 video_title
= mobj
.group(1)
40 'title' : video_title
,
41 'thumbnail' : thumbnail
,