Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_stream_url(self, info):
try:
format_selector = self._ydl.build_format_selector(self._best_format)
except ValueError:
raise FormatError("The specified format filter is invalid")
try:
best_format = next(format_selector(info))
except StopIteration:
raise FormatError("No suitable format was found")
# This is thrown when url points directly to media file.
except KeyError:
best_format = info
return best_format["url"]
def _get_stream_url(self, info):
try:
format_selector = self._ydl.build_format_selector(self._best_format)
except ValueError:
raise FormatError("The specified format filter is invalid")
try:
best_format = next(format_selector(info))
except StopIteration:
raise FormatError("No suitable format was found")
# This is thrown when url points directly to media file.
except KeyError:
best_format = info
return best_format["url"]