[voicerepublic] Raise ExtractorError if audio is still being processed

This commit is contained in:
Duncan 2015-05-10 15:12:29 +12:00
parent 03f760b1c0
commit f03a8a3c4e

View file

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