Merge pull request #1409 from JohnyMoSwag/master (closes #1404)
[youtube-dl] / youtube_dl / extractor / jukebox.py
index 5eb255bf7fa63089e628263a04c9862af407cac9..c7bb234fe9eec9bd848f2a19c4307722cc4bbca0 100644 (file)
@@ -1,3 +1,4 @@
+# coding: utf-8
 import re
 
 from .common import InfoExtractor
@@ -7,18 +8,14 @@ from ..utils import (
 )
 
 class JukeboxIE(InfoExtractor):
-    _VALID_URL = r'^http://www\.jukebox\.es\/.+[,](?P<video_id>[a-z0-9]+).html'
+    _VALID_URL = r'^http://www\.jukebox?\..+?\/.+[,](?P<video_id>[a-z0-9\-]+).html'
     _IFRAME = r'<iframe .*src="(?P<iframe>[^"]*)".*>'
     _VIDEO_URL = r'"config":{"file":"(?P<video_url>http:[^"]+[.](?P<video_ext>[^.?]+)[?]mdtk=[0-9]+)"'
     _TITLE = r'<h1 class="inline">(?P<title>[^<]+)</h1>.*<span id="infos_article_artist">(?P<artist>[^<]+)</span>'
-    _NOT_AVAILABLE = r'<span>Este video no está disponible por el momento [!]</span>'
     _IS_YOUTUBE = r'config":{"file":"(?P<youtube_url>http:[\\][/][\\][/]www[.]youtube[.]com[\\][/]watch[?]v=[^"]+)"'
-    IE_NAME = u'jukebox'
 
     def _real_extract(self, url):
         mobj = re.match(self._VALID_URL, url)
-        if mobj is None:
-            raise ExtractorError(u'Invalid URL: %s' % url)
         video_id = mobj.group('video_id')
 
         html = self._download_webpage(url, video_id)
@@ -29,7 +26,7 @@ class JukeboxIE(InfoExtractor):
         iframe_url = unescapeHTML(mobj.group('iframe'))
 
         iframe_html = self._download_webpage(iframe_url, video_id, 'Downloading iframe')
-        mobj = re.search(self._NOT_AVAILABLE, iframe_html)
+        mobj = re.search(r'class="jkb_waiting"', iframe_html)
         if mobj is not None:
             raise ExtractorError(u'Video is not available(in your country?)!')