From 180e689f7e590e2987c00dee684ec205bc6b9933 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Sat, 4 May 2013 08:06:56 +0200 Subject: [PATCH] Simplify WorldStarHipHop --- youtube_dl/InfoExtractors.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 325c5ecd4..79182208d 100755 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -3483,7 +3483,7 @@ class UstreamIE(InfoExtractor): return [info] class WorldStarHipHopIE(InfoExtractor): - _VALID_URL = r'http://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P.*)' + _VALID_URL = r'https?://(?:www|m)\.worldstar(?:candy|hiphop)\.com/videos/video\.php\?v=(?P.*)' IE_NAME = u'WorldStarHipHop' def _real_extract(self, url): @@ -3503,21 +3503,15 @@ class WorldStarHipHopIE(InfoExtractor): else: ext = 'flv' else: - self._downloader.report_error(u'Cannot find video url for %s' % video_id) - return + raise ExtractorError(u'Cannot find video url for %s' % video_id) - _title = r"""(.*)""" + mobj = re.search(r"(.*)", webpage_src) - 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) + if mobj is None: + raise ExtractorError(u'Cannot determine title') + title = mobj.group(1) + mobj = re.search(r'rel="image_src" href="(.*)" />', webpage_src) # Getting thumbnail and if not thumbnail sets correct title for WSHH candy video. if mobj is not None: thumbnail = mobj.group(1)