Fix media_extractor for some sites (#8887)

This commit is contained in:
Alexey 2017-08-08 16:21:32 +03:00 committed by Pascal Vizeli
parent cc5893ed8b
commit 588b36dff2

View File

@ -125,24 +125,13 @@ class MediaExtractor:
else: else:
selected_media = all_media selected_media = all_media
try:
media_info = ydl.process_ie_result(selected_media,
download=False)
except (ExtractorError, DownloadError):
# This exception will be logged by youtube-dl itself
raise MEDownloadException()
def stream_selector(query): def stream_selector(query):
"""Find stream url that matches query.""" """Find stream url that matches query."""
try: try:
format_selector = ydl.build_format_selector(query) ydl.params['format'] = query
except (SyntaxError, ValueError, AttributeError) as ex: requested_stream = ydl.process_ie_result(selected_media,
_LOGGER.error(ex) download=False)
raise MEQueryException() except (ExtractorError, DownloadError):
try:
requested_stream = next(format_selector(media_info))
except (KeyError, StopIteration):
_LOGGER.error("Could not extract stream for the query: %s", _LOGGER.error("Could not extract stream for the query: %s",
query) query)
raise MEQueryException() raise MEQueryException()