1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
Streaming protocols
===================
There are many types of streaming protocols used by services today and
Streamlink supports most of them. It's possible to tell Streamlink
to access a streaming protocol directly instead of relying on a plugin
to extract the streams from a URL for you.
Playing built-in streaming protocols directly
---------------------------------------------
A streaming protocol can be accessed directly by specifying it in the ``protocol://URL`` format
with an optional list of parameters, like so:
.. code-block:: console
$ streamlink "protocol://https://streamingserver/path key1=value1 key2=value2"
Depending on the input URL, the explicit protocol scheme may be omitted.
The following example shows HLS streams (``.m3u8``) and DASH streams (``.mpd``):
.. code-block:: console
$ streamlink "https://streamingserver/playlist.m3u8"
$ streamlink "https://streamingserver/manifest.mpd"
Supported streaming protocols
-----------------------------
.. list-table::
:header-rows: 1
:class: table-custom-layout
* - Name
- Explicit prefix
* - Apple HTTP Live Streaming
- ``hls://``
* - MPEG-DASH
- ``dash://``
* - Progressive HTTP/HTTPS
- ``httpstream://``
.. note::
Local files can be read by adding the ``file://`` scheme to the ``URL`` component.
Protocol parameters
-------------------
When passing parameters to the built-in streaming protocols, the values will either be treated as plain strings
or they will be interpreted as Python literals:
.. code-block:: console
$ streamlink "httpstream://https://streamingserver/path method=POST params={'abc':123} json=['foo','bar','baz']"
.. code-block:: python
method="POST"
params={"key": 123}
json=["foo", "bar", "baz"]
The parameters from the example above are used to make an HTTP ``POST`` request with ``abc=123`` added
to the query string and ``["foo", "bar", "baz"]`` used as the content of the HTTP request's body (the serialized JSON data).
Some parameters allow you to configure the behavior of the streaming protocol implementation directly:
.. code-block:: console
$ streamlink "hls://https://streamingserver/path start_offset=123 duration=321 force_restart=True"
Available parameters
--------------------
Parameters are passed to the following methods of their respective stream implementations:
.. list-table::
:header-rows: 1
:class: table-custom-layout
* - Protocol prefix
- Method references
* - ``httpstream://``
- - :py:meth:`streamlink.stream.HTTPStream`
- :py:meth:`requests.Session.request`
* - ``hls://``
- - :py:meth:`streamlink.stream.HLSStream.parse_variant_playlist`
- :py:meth:`streamlink.stream.HLSStream`
- :py:meth:`streamlink.stream.MuxedHLSStream`
- :py:meth:`requests.Session.request`
* - ``dash://``
- - :py:meth:`streamlink.stream.DASHStream.parse_manifest`
- :py:meth:`requests.Session.request`
|