]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[voicerepublic] Raise ExtractorError if audio is still being processed
authorDuncan <duncan@vtllf.org>
Sun, 10 May 2015 03:12:29 +0000 (15:12 +1200)
committerDuncan <duncan@vtllf.org>
Sun, 10 May 2015 03:50:06 +0000 (15:50 +1200)
youtube_dl/extractor/voicerepublic.py

index 960974e167a18bd3b4688d130a333bbe7474cdc0..d3e35a815b6844df4f5e193ea1f83262f0b0aa6a 100644 (file)
@@ -2,10 +2,8 @@
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
-
-from ..compat import (
-    compat_urllib_request,
-)
+from ..compat import compat_urllib_request
+from ..utils import ExtractorError
 
 
 class VoiceRepublicIE(InfoExtractor):
@@ -31,17 +29,16 @@ class VoiceRepublicIE(InfoExtractor):
         thumbnail = self._og_search_thumbnail(webpage)
         video_id = self._search_regex(r'/(\d+)\.png', thumbnail, 'id')
 
-        if '<div class=\'vr-player jp-jplayer\'' in webpage:
-            formats = [{
-                'url': 'https://voicerepublic.com/vrmedia/{}-clean.{}'.format(video_id, ext),
-                'ext': ext,
-                'format_id': ext,
-                'vcodec': 'none',
-            } for ext in ['m4a', 'mp3', 'ogg']]
-            self._sort_formats(formats)
-        else:
-            # Audio is still queued for processing
-            formats = []
+        if '<a>Queued for processing, please stand by...</a>' in webpage:
+            raise ExtractorError('Audio is still queued for processing')
+
+        formats = [{
+            'url': 'https://voicerepublic.com/vrmedia/{}-clean.{}'.format(video_id, ext),
+            'ext': ext,
+            'format_id': ext,
+            'vcodec': 'none',
+        } for ext in ['m4a', 'mp3', 'ogg']]
+        self._sort_formats(formats)
 
         return {
             'id': video_id,