mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix media_extractor for some sites (#8887)
This commit is contained in:
parent
cc5893ed8b
commit
588b36dff2
@ -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()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user