aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/InfoExtractors.py
diff options
context:
space:
mode:
authorFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-29 16:14:49 +0100
committerFilippo Valsorda <filippo.valsorda@gmail.com>2013-03-29 16:14:49 +0100
commit46b9d8295d43bb4a5954da95293ef2490eb28b5e (patch)
treed3682415ec3939ea32212ded469375970d9b5edf /youtube_dl/InfoExtractors.py
parent7decf8951cd500acc6ed7c9ad049996957e26d73 (diff)
parent44e939514ebb37f002bc9a2663e8669c3a201da8 (diff)
Merge pull request #730 by @JohnyMoSwag
Support for Worldstarhiphop.com
Diffstat (limited to 'youtube_dl/InfoExtractors.py')
-rwxr-xr-xyoutube_dl/InfoExtractors.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index b3c3dbb43..b4c86cfa3 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -3687,6 +3687,62 @@ class UstreamIE(InfoExtractor):
}
return [info]
+class WorldStarHipHopIE(InfoExtractor):
+ _VALID_URL = r'http://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P<id>.*)'
+ IE_NAME = u'WorldStarHipHop'
+
+ def _real_extract(self, url):
+ _src_url = r"""(http://hw-videos.*(?:mp4|flv))"""
+
+ webpage_src = compat_urllib_request.urlopen(url).read()
+ webpage_src = webpage_src.decode('utf-8')
+
+ mobj = re.search(_src_url, webpage_src)
+
+ m = re.match(self._VALID_URL, url)
+ video_id = m.group('id')
+
+ if mobj is not None:
+ video_url = mobj.group()
+ if 'mp4' in video_url:
+ ext = 'mp4'
+ else:
+ ext = 'flv'
+ else:
+ self._downloader.trouble(u'ERROR: Cannot find video url for %s' % video_id)
+ return
+
+ _title = r"""<title>(.*)</title>"""
+
+ mobj = re.search(_title, webpage_src)
+
+ if mobj is not None:
+ title = mobj.group(1)
+ else:
+ title = 'World Start Hip Hop - %s' % time.ctime()
+
+ _thumbnail = r"""rel="image_src" href="(.*)" />"""
+ mobj = re.search(_thumbnail, webpage_src)
+
+ # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video.
+ if mobj is not None:
+ thumbnail = mobj.group(1)
+ else:
+ _title = r"""candytitles.*>(.*)</span>"""
+ mobj = re.search(_title, webpage_src)
+ if mobj is not None:
+ title = mobj.group(1)
+ thumbnail = None
+
+ results = [{
+ 'id': video_id,
+ 'url' : video_url,
+ 'title' : title,
+ 'thumbnail' : thumbnail,
+ 'ext' : ext,
+ }]
+ return results
+
class RBMARadioIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<videoID>[^/]+)$'
@@ -4249,6 +4305,7 @@ def gen_extractors():
GooglePlusIE(),
ArteTvIE(),
NBAIE(),
+ WorldStarHipHopIE(),
JustinTVIE(),
FunnyOrDieIE(),
SteamIE(),