aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/index.rst
blob: 1797f767b98be7a7dfe5e1b7d05f71b6dda582fa (plain)
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
.. livestreamer documentation master file, created by
   sphinx-quickstart on Fri Aug 24 00:12:10 2012.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

livestreamer documentation
==================================

Livestreamer is a library that can be used to retrieve information and stream data from
various livestreaming services, such as Twitch, Own3D or UStream.


.. automodule:: livestreamer

Exceptions
----------

The :mod:`livstreamer` module defines four exceptions:

.. exception:: PluginError

    Common base class for the plugin related exceptions. It inherits
    :exc:`Exception`.

.. exception:: NoStreamsError

    This exception is triggered when no streams can be found by a plugin.
    It inherits :exc:`PluginError`.

.. exception:: NoPluginError

    This exception is triggered when no plugin can found when calling :meth:`Livestreamer.resolve_url`.
    It inherits :exc:`PluginError`.

.. exception:: StreamError

    Common base class for stream related exceptions. It inherits
    :exc:`Exception`.

The livestreamer session
------------------------
.. autoclass:: Livestreamer
    :members:

.. automodule:: livestreamer.plugins

Plugins
-------
.. autoclass:: Plugin
    :members:

.. automodule:: livestreamer.stream


Streams
-------
.. autoclass:: Stream
    :members:


Examples
--------

Fetching a streams data::

    from livestreamer import Livestreamer

    url = "http://twitch.tv/day9tv"
    livestreamer = Livestreamer()
    channel = livestreamer.resolve_url(url)
    streams = channel.get_streams()

    stream = streams["720p"]
    fd = stream.open()

    while True:
        data = fd.read(1024)
        if len(data) == 0:
            break

        # do something with data

    fd.close()





Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`