How to use the catt.error.FormatError function in catt

To help you get started, we’ve selected a few catt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skorokithakis / catt / catt / stream_info.py View on Github external
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"]
github skorokithakis / catt / catt / stream_info.py View on Github external
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"]