### Install Node.js Dependencies for StreamGet Source: https://streamget.readthedocs.io/en/latest/quickstart Provides command-line instructions for installing Node.js dependencies required by some live streaming platforms when using StreamGet. It also shows how to access help information for the installation command. ```bash streamget install-node ``` ```bash streamget install-node -h ``` -------------------------------- ### View Supported Platforms with StreamGet CLI Source: https://streamget.readthedocs.io/en/latest/quickstart Provides the command-line instruction to view a list of all live streaming platforms currently supported by the StreamGet library. This command also displays general help information for the StreamGet CLI. ```bash streamget -h ``` -------------------------------- ### Configure StreamGet with Proxy Server Source: https://streamget.readthedocs.io/en/latest/quickstart Shows how to configure StreamGet to use a proxy server for requests, which is necessary for accessing certain platforms. This is done by providing the proxy URL string when instantiating a stream object. ```python >>> proxy = 'http://127.0.0.1:7890' >>> live = streamget.DouyinLiveStream(proxy=proxy) ``` -------------------------------- ### Install Node.js Runtime for StreamGet Source: https://streamget.readthedocs.io/en/latest This command installs the Node.js runtime, which is optional but required for some features of StreamGet. This is a convenience command provided by the streamget package. ```bash streamget install-node ``` -------------------------------- ### Install StreamGet with Pip Source: https://streamget.readthedocs.io/en/latest This command installs the StreamGet library using pip from a specific index URL. It requires Python 3.10 or later. ```bash pip install -i https://pypi.org/simple streamget ``` -------------------------------- ### Import and Fetch Web Stream Data with StreamGet Source: https://streamget.readthedocs.io/en/latest/quickstart Demonstrates how to import the StreamGet library and use the `DouyinLiveStream` class to fetch live stream data from a given URL. It shows how to handle both processed and raw data responses. Dependencies include `asyncio` and `streamget`. ```python >>> import asyncio >>> import streamget >>> live = streamget.DouyinLiveStream() >>> data = asyncio.run(live.fetch_web_stream_data(url)) >>> data {'anchor_name': 'xxxxx', 'is_live': False} or {'anchor_name': 'xxxxx', 'is_live': True, 'title': 'xxxx', ...} >>> data = asyncio.run(live.fetch_web_stream_data(url, process_data=False)) >>> data The official API raw data will be returned ``` -------------------------------- ### Fetch Live Streaming Source URL with StreamGet Source: https://streamget.readthedocs.io/en/latest/quickstart Shows how to obtain the direct live streaming source URL (e.g., m3u8) after fetching the stream data. This requires `process_data` to be True. The output is a `StreamData` object containing the stream URL. Dependencies include `asyncio` and `streamget`. ```python >>> import asyncio >>> from streamget import DouyinLiveStream >>> live = DouyinLiveStream() >>> data = asyncio.run(live.fetch_web_stream_data(url, process_data=True)) >>> stream_obj = asyncio.run(live.fetch_stream_url(data, "OD")) StreamData(platform='xxxx', anchor_name='xxxx', is_live=True, m3u8_url="xxx"...) ``` -------------------------------- ### Convert Stream Object to JSON String with StreamGet Source: https://streamget.readthedocs.io/en/latest/quickstart Demonstrates how to convert a `StreamData` object obtained from StreamGet into a JSON string using the `to_json` method. This is useful for serializing or transmitting the stream data. Dependencies include `asyncio` and `streamget`. ```python >>> import asyncio >>> from streamget import DouyinLiveStream >>> live = DouyinLiveStream() >>> data = asyncio.run(live.fetch_web_stream_data(url, process_data=True)) >>> stream_obj = asyncio.run(live.fetch_stream_url(data, "OD")) >>> json_str = stream_obj.to_json() '{"anchor_name": "xxxx", "is_live": True, "flv_url": "...", "m3u8_url": "..."}' ``` -------------------------------- ### Configure StreamGet with Custom Cookies Source: https://streamget.readthedocs.io/en/latest/quickstart Illustrates how to include custom cookies in HTTP requests made by StreamGet by passing a cookie string during the instantiation of a stream object (e.g., `DouyinLiveStream`). The returned `Stream` object will have a `new_comkie` attribute reflecting any updated cookies. ```python >>> cookies = 'key1=value1;key2=value2;' >>> live = streamget.DouyinLiveStream(cookies=cookies) ``` -------------------------------- ### Quick Start: Fetching Live Stream Data in Python Source: https://streamget.readthedocs.io/en/latest This Python code snippet demonstrates how to use the StreamGet library to fetch live stream data from a Douyin URL. It utilizes asyncio for asynchronous operations to retrieve stream information and the stream URL for a specified quality. ```python >>> import asyncio >>> from streamget import DouyinLiveStream >>> url = "https://live.douyin.com/xxxxxxx" >>> live = DouyinLiveStream() >>> data = asyncio.run(live.fetch_web_stream_data(url)) >>> stream_obj = asyncio.run(live.fetch_stream_url(data, "OD")) StreamData(platform='xxxx', anchor_name='xxxx', is_live=True, m3u8_url="xxx"...) >>> json_str = stream_obj.to_json() '{"anchor_name": "xxxx", "is_live": True, "flv_url": "...", "m3u8_url": "..."}' ``` -------------------------------- ### Instantiate DouyinLiveStream Object Source: https://streamget.readthedocs.io/en/latest/parameter_parsing Initializes a DouyinLiveStream object for fetching Douyin live stream data. Optional parameters like cookies and proxy can be provided during instantiation. ```python from streamget import DouyinLiveStream # Basic instantiation live = DouyinLiveStream() # Instantiation with cookies cookies = 'key1=value1;key2=value2;' live_with_cookies = DouyinLiveStream(cookies=cookies) # Instantiation with proxy proxy = "http://127.0.0.1:7890" live_with_proxy = DouyinLiveStream(proxy=proxy) ``` -------------------------------- ### Fetch Web Stream Data Source: https://streamget.readthedocs.io/en/latest/parameter_parsing Fetches data from a live streaming webpage. The `process_data` parameter controls whether the data is returned in a raw or structured format. Requires the `asyncio` library for asynchronous execution. ```python import asyncio url = "https://example.com/live" data = asyncio.run(live.fetch_web_stream_data(url, process_data=True)) ``` -------------------------------- ### Set Video Quality with fetch_stream_url in Python Source: https://streamget.readthedocs.io/en/latest/video_quality_options Demonstrates how to set the video quality for fetching a stream URL using the `fetch_stream_url` method. Supports setting quality by name (e.g., 'OD') or by index (e.g., 0). If not specified, it defaults to the highest quality (OD). ```python # Using the default quality (OD) stream_obj = asyncio.run(live.fetch_stream_url(data)) # Explicitly setting the quality to OD stream_obj = asyncio.run(live.fetch_stream_url(data, video_quality="OD")) # Using quality index for OD stream_obj = asyncio.run(live.fetch_stream_url(data, video_quality=0)) ``` -------------------------------- ### Fetch Stream URL Source: https://streamget.readthedocs.io/en/latest/parameter_parsing Retrieves the streaming URL from processed data. Allows specifying desired video quality. Requires the `asyncio` library for asynchronous execution. ```python import asyncio # Assuming 'data' is the output from fetch_web_stream_data stream_obj = asyncio.run(live.fetch_stream_url(data, video_quality="OD")) ``` -------------------------------- ### Convert Stream Object to JSON Source: https://streamget.readthedocs.io/en/latest/parameter_parsing Converts a Stream object, obtained from `fetch_stream_url`, into a JSON string representation of its attributes. This is useful for serialization and debugging. ```python # Assuming 'stream_obj' is a Stream object json_str = stream_obj.to_json() print(json_str) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.