You are reading the documentation for the in-development version of Streamlink.

Options

class streamlink.options.Options(defaults=None)

Bases: object

For storing options to be used by the Streamlink session and plugins, with default values.

Note: Option names are normalized by replacing "_" with "-".

This means that the keys example_one and example-one are equivalent.

Parameters:

defaults (Mapping[str, Any] | None)

clear()

Restore default options

Return type:

None

get(key)

Get the stored value of a specific key

Parameters:

key (str)

Return type:

Any

get_explicit(key)

Get the stored value of a specific key and ignore any get-mappings

Parameters:

key (str)

Return type:

Any

set(key, value)

Set the value for a specific key

Parameters:
  • key (str)

  • value (Any)

Return type:

None

set_explicit(key, value)

Set the value for a specific key and ignore any set-mappings

Parameters:
  • key (str)

  • value (Any)

Return type:

None

update(options)

Merge options

Parameters:

options (Mapping[str, Any])

Return type:

None

_MAP_GETTERS: ClassVar[Mapping[str, Callable[[Any, str], Any]]] = {}

Optional getter mapping for Options subclasses

_MAP_SETTERS: ClassVar[Mapping[str, Callable[[Any, str, Any], None]]] = {}

Optional setter mapping for Options subclasses

class streamlink.options.Argument(name, action=None, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None, dest=None, requires=None, prompt=None, sensitive=False, argument_name=None)

Bases: object

Accepts most of the parameters accepted by argparse.ArgumentParser.add_argument(), except that

  • name is the name relative to the plugin name (can be overridden by argument_name) and that only one argument name is supported

  • action must be a string and can't be a custom Action

  • required is a special case which is only enforced if the plugin is in use

This class should not be instantiated directly. See the pluginargument decorator for adding custom plugin arguments.

Parameters:
  • name (str) -- Argument name, without leading -- or plugin name prefixes, e.g. "username", "password", etc.

  • action (str | None) -- See ArgumentParser.add_argument()

  • nargs (int | Literal['?', '*', '+'] | None) -- See ArgumentParser.add_argument()

  • const (Any) -- See ArgumentParser.add_argument()

  • default (Any) -- See ArgumentParser.add_argument()

  • type (Callable[[Any], _TChoices | Any] | None) -- See ArgumentParser.add_argument()

  • choices (_TChoices | None) -- See ArgumentParser.add_argument()

  • required (bool) -- See ArgumentParser.add_argument()

  • help (str | None) -- See ArgumentParser.add_argument()

  • metavar (str | list[str] | tuple[str, ...] | None) -- See ArgumentParser.add_argument()

  • dest (str | None) -- See ArgumentParser.add_argument()

  • requires (str | list[str] | tuple[str, ...] | None) -- List of other arguments which this argument requires, e.g. ["password"]

  • prompt (str | None) -- If the argument is required and not set, then this prompt message will be shown instead

  • sensitive (bool) -- Whether the argument is sensitive and should be masked (passwords, etc.)

  • argument_name (str | None) -- Custom CLI argument name without the automatically added plugin name prefix

class streamlink.options.Arguments(*args)

Bases: Dict[str, Argument]

A collection of Argument instances for Plugin classes.

Should not be called directly, see the pluginargument decorator.

requires(name)

Find all Argument instances required by name

Parameters:

name (str)

Return type:

Iterator[Argument]