Fix media_extractor for some sites (#8887)

pull/8895/head
Alexey 2017-08-08 16:21:32 +03:00 committed by Pascal Vizeli
parent cc5893ed8b
commit 588b36dff2
1 changed files with 4 additions and 15 deletions

View File

@ -125,24 +125,13 @@ class MediaExtractor:
else:
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):
"""Find stream url that matches query."""
try:
format_selector = ydl.build_format_selector(query)
except (SyntaxError, ValueError, AttributeError) as ex:
_LOGGER.error(ex)
raise MEQueryException()
try:
requested_stream = next(format_selector(media_info))
except (KeyError, StopIteration):
ydl.params['format'] = query
requested_stream = ydl.process_ie_result(selected_media,
download=False)
except (ExtractorError, DownloadError):
_LOGGER.error("Could not extract stream for the query: %s",
query)
raise MEQueryException()