pyxtream


Namepyxtream JSON
Version 0.7.2 PyPI version JSON
download
home_pagehttps://github.com/superolmo/pyxtream
Summaryxtream IPTV loader
upload_time2024-12-20 03:02:44
maintainerNone
docs_urlNone
authorClaudio Olmi
requires_python>=3.9
licenseGPL3
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PyXtream - A Python Xtream Loader

PyXtream loads the xtream IPTV content from a provider server. Groups, Channels, Series are all organized in dictionaries. Season and Episodes are retrieved as needed. It includes functions for searching streams and downloading.

This library was originally designed to work with Hypnotix at https://github.com/linuxmint/hypnotix

# Installing

Installing pyxtream is done using pip3.

```shell
pip3 install pyxtream
```

Optionally, to use the REST Api service, install also Flask via the following command or manually.

```shell
pip3 install pyxtream[REST_API]
```


# Quick Start

## Your own application

Integrating in your application is simple. Initialization and loading of IPTV channels and groups is done with the following code.

```python
from pyxtream import XTream
xt = XTream(servername, username, password, url)
if xt.authData != {}:
    xt.load_iptv()
else:
    print("Could not connect")
```

Once completed, all the data can be found in xTream.groups, xTream.channels, xTream.movies, xTream.series. Series do not contains the information for all the Seasons and Episodes. Those are loaded separately when needed by calling the following function using a Series object from xTream.series array of dictionaries.

```python
xt.get_series_info_by_id(series_obj)
```

At this point, the series_obj will have both Seasons and Episodes populated.

If you have installed Flask, the REST Api will be turned ON automatically. At this point, there is no method to turn it off. Maybe in a future version.

## Functional Test

Please modify the functional_test.py file with your provider information, then start the application.

```shell
python3 functional_test.py
```

The functional test will allow you to authenticate on startup, load and search streams. If Flask is installed, a simple website will be available at http://localhost:5000 to allow you to search and play streams.

## Interesting Work by somebody else 

- xtreamPOC - https://github.com/sght500/xtreamPOC - Project is a Proof of Concept (POC) that leverages pyxtream, MPV, and NiceGUI to demonstrate the use of Xtream Portal Codes.

So far there is no ready to use Transport Stream library for playing live stream.

- This is the library to convert TS to MP4
  - https://github.com/videojs/mux.js/

- More on above, but same problem. XMLHttpRequest waits until the whole TS file is completely loaded. It does not work for live video streams
  - https://developpaper.com/play-ts-video-directly-on-the-web/

- This below will allow me to process chunks of data
  - https://stackoverflow.com/questions/37402716/handle-xmlhttprequest-response-with-large-data


# API

## Classes:

Below are the classes used in the module. They are heavily influenced by the application Hypnotix.

- XTream.Channels
- XTream.Groups
- XTream.Episode
- XTream.Series
- XTream.Season

## Dictionaries (Array of dictionaries):

xTream.groups[{},{},...]

xTream.channels[{},{},...]

xTream.series[{},{},...]

xTream.movies[{},{},...]

## Functions:

- xTream.authenticate()
- xTream.load_iptv()
- XTream.get_series_info_by_id(get_series: dict)
- xTream.search_stream(keyword: str, ignore_case: bool = True, return_type: str = "LIST")
- xTream.download_video(stream_id: int)
- xTream.vodInfoByID(vod_id)
- xTream.liveEpgByStream(stream_id)
- xTream.liveEpgByStreamAndLimit(stream_id, limit)
- xTream.allLiveEpgByStream(stream_id)
- xTream.allEpg()

# Versioning
- Increment the MAJOR version when you make incompatible API changes.
- Increment the MINOR version when you add functionality in a backwards-compatible manner.
- Increment the PATCH version when you make backwards-compatible bug fixes.

# Change Log

| Date | Version | Description |
| ----------- | -----| ----------- |
| 2024-09-02 | 0.7.2 | - Added missing request package to setup.py<br>- Refactored the search stream function and now, it can search for a specific stream type<br>- Refactored the download stream function<br>- Refactored the _get_request function and removed the call to the sleep function<br>- Added functional test to get series json output from a series_id<br>- Added functional test to get EPG for a specific stream ID<br>- Added xtream account expiration date printed on the console during authentication<br>- Improved results with the Flask HTML page and differentiating between movies and series<br>- Improved code readability|
| 2024-05-21 | 0.7.1 | - Fixed missing jsonschema package<br>- Fixed provider name in functional_test<br>- Improved print out of connection attempts<br>- Added method to read latest changes in functional_test
| 2023-11-08 | 0.7.0 | - Added Schema Validator<br>- Added Channel Age<br>- Added list of movies added in the last 30 and 7 days<br>- Updated code based on PyLint<br>- Fixed Flask package to be optional [richard-de-vos](https://github.com/richard-de-vos)|
| 2023-02-06 | 0.6.0 | - Added methods to change connection header, to turn off reload timer, and to enable/disable Flask debug mode<br>- Added a loop when attempting to connect to the provider <br>- Cleaned up some print lines|
| 2021-08-19 | 0.5.0 | - Added method to gracefully handle connection errors<br>- Added setting to not load adult content<br>- Added sorting by stream name<br>- Changed the handling of special characters in streams<br>- Changed print formatting<br>- Changed index.html webpage to HTML5 and Bootstrap 5|
| 2021-06-19 | 0.4.0 | - Updated to follow PEP8<br>- Updated Docstrings |
| 2021-06-19 | 0.3.0 | - Added enhanced Home Page with Search Button and Player<br>- Added case insensitive search<br>- Improved handling of provider missing fields |
| 2021-06-11 | 0.2.1 | - Fixed bug in the way it reload from cache |
| 2021-06-08 | 0.2.0 | - Added searching<br>- Added video download<br>- Added REST Api<br>- Fixed cache-path issue |
| 2021-06-05 | 0.1.2 | - Fixed Server Name |
| 2021-06-04 | 0.1.1 | - Updated README.md |
| 2021-06-04 | 0.1.0 | - Initial Release |

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/superolmo/pyxtream",
    "name": "pyxtream",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Claudio Olmi",
    "author_email": "superolmo2@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b7/cf/83f79d04627e2ac331e0c4368fa9a9042f1f0e4ea02e47228cac775d95a7/pyxtream-0.7.2.tar.gz",
    "platform": null,
    "description": "# PyXtream - A Python Xtream Loader\n\nPyXtream loads the xtream IPTV content from a provider server. Groups, Channels, Series are all organized in dictionaries. Season and Episodes are retrieved as needed. It includes functions for searching streams and downloading.\n\nThis library was originally designed to work with Hypnotix at https://github.com/linuxmint/hypnotix\n\n# Installing\n\nInstalling pyxtream is done using pip3.\n\n```shell\npip3 install pyxtream\n```\n\nOptionally, to use the REST Api service, install also Flask via the following command or manually.\n\n```shell\npip3 install pyxtream[REST_API]\n```\n\n\n# Quick Start\n\n## Your own application\n\nIntegrating in your application is simple. Initialization and loading of IPTV channels and groups is done with the following code.\n\n```python\nfrom pyxtream import XTream\nxt = XTream(servername, username, password, url)\nif xt.authData != {}:\n    xt.load_iptv()\nelse:\n    print(\"Could not connect\")\n```\n\nOnce completed, all the data can be found in xTream.groups, xTream.channels, xTream.movies, xTream.series. Series do not contains the information for all the Seasons and Episodes. Those are loaded separately when needed by calling the following function using a Series object from xTream.series array of dictionaries.\n\n```python\nxt.get_series_info_by_id(series_obj)\n```\n\nAt this point, the series_obj will have both Seasons and Episodes populated.\n\nIf you have installed Flask, the REST Api will be turned ON automatically. At this point, there is no method to turn it off. Maybe in a future version.\n\n## Functional Test\n\nPlease modify the functional_test.py file with your provider information, then start the application.\n\n```shell\npython3 functional_test.py\n```\n\nThe functional test will allow you to authenticate on startup, load and search streams. If Flask is installed, a simple website will be available at http://localhost:5000 to allow you to search and play streams.\n\n## Interesting Work by somebody else \n\n- xtreamPOC - https://github.com/sght500/xtreamPOC - Project is a Proof of Concept (POC) that leverages pyxtream, MPV, and NiceGUI to demonstrate the use of Xtream Portal Codes.\n\nSo far there is no ready to use Transport Stream library for playing live stream.\n\n- This is the library to convert TS to MP4\n  - https://github.com/videojs/mux.js/\n\n- More on above, but same problem. XMLHttpRequest waits until the whole TS file is completely loaded. It does not work for live video streams\n  - https://developpaper.com/play-ts-video-directly-on-the-web/\n\n- This below will allow me to process chunks of data\n  - https://stackoverflow.com/questions/37402716/handle-xmlhttprequest-response-with-large-data\n\n\n# API\n\n## Classes:\n\nBelow are the classes used in the module. They are heavily influenced by the application Hypnotix.\n\n- XTream.Channels\n- XTream.Groups\n- XTream.Episode\n- XTream.Series\n- XTream.Season\n\n## Dictionaries (Array of dictionaries):\n\nxTream.groups[{},{},...]\n\nxTream.channels[{},{},...]\n\nxTream.series[{},{},...]\n\nxTream.movies[{},{},...]\n\n## Functions:\n\n- xTream.authenticate()\n- xTream.load_iptv()\n- XTream.get_series_info_by_id(get_series: dict)\n- xTream.search_stream(keyword: str, ignore_case: bool = True, return_type: str = \"LIST\")\n- xTream.download_video(stream_id: int)\n- xTream.vodInfoByID(vod_id)\n- xTream.liveEpgByStream(stream_id)\n- xTream.liveEpgByStreamAndLimit(stream_id, limit)\n- xTream.allLiveEpgByStream(stream_id)\n- xTream.allEpg()\n\n# Versioning\n- Increment the MAJOR version when you make incompatible API changes.\n- Increment the MINOR version when you add functionality in a backwards-compatible manner.\n- Increment the PATCH version when you make backwards-compatible bug fixes.\n\n# Change Log\n\n| Date | Version | Description |\n| ----------- | -----| ----------- |\n| 2024-09-02 | 0.7.2 | - Added missing request package to setup.py<br>- Refactored the search stream function and now, it can search for a specific stream type<br>- Refactored the download stream function<br>- Refactored the _get_request function and removed the call to the sleep function<br>- Added functional test to get series json output from a series_id<br>- Added functional test to get EPG for a specific stream ID<br>- Added xtream account expiration date printed on the console during authentication<br>- Improved results with the Flask HTML page and differentiating between movies and series<br>- Improved code readability|\n| 2024-05-21 | 0.7.1 | - Fixed missing jsonschema package<br>- Fixed provider name in functional_test<br>- Improved print out of connection attempts<br>- Added method to read latest changes in functional_test\n| 2023-11-08 | 0.7.0 | - Added Schema Validator<br>- Added Channel Age<br>- Added list of movies added in the last 30 and 7 days<br>- Updated code based on PyLint<br>- Fixed Flask package to be optional [richard-de-vos](https://github.com/richard-de-vos)|\n| 2023-02-06 | 0.6.0 | - Added methods to change connection header, to turn off reload timer, and to enable/disable Flask debug mode<br>- Added a loop when attempting to connect to the provider <br>- Cleaned up some print lines|\n| 2021-08-19 | 0.5.0 | - Added method to gracefully handle connection errors<br>- Added setting to not load adult content<br>- Added sorting by stream name<br>- Changed the handling of special characters in streams<br>- Changed print formatting<br>- Changed index.html webpage to HTML5 and Bootstrap 5|\n| 2021-06-19 | 0.4.0 | - Updated to follow PEP8<br>- Updated Docstrings |\n| 2021-06-19 | 0.3.0 | - Added enhanced Home Page with Search Button and Player<br>- Added case insensitive search<br>- Improved handling of provider missing fields |\n| 2021-06-11 | 0.2.1 | - Fixed bug in the way it reload from cache |\n| 2021-06-08 | 0.2.0 | - Added searching<br>- Added video download<br>- Added REST Api<br>- Fixed cache-path issue |\n| 2021-06-05 | 0.1.2 | - Fixed Server Name |\n| 2021-06-04 | 0.1.1 | - Updated README.md |\n| 2021-06-04 | 0.1.0 | - Initial Release |\n",
    "bugtrack_url": null,
    "license": "GPL3",
    "summary": "xtream IPTV loader",
    "version": "0.7.2",
    "project_urls": {
        "Homepage": "https://github.com/superolmo/pyxtream"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a0c5ac6499bbad2bf328f53a123d47a3e5cd5eedaf5a727928dbda93b969b38",
                "md5": "21cbe87faf075900fdb8e535a25751f5",
                "sha256": "ab234f34e2d88f9245b024db158c2ea1ed72b6229732cf8640ec330fe7824146"
            },
            "downloads": -1,
            "filename": "pyxtream-0.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "21cbe87faf075900fdb8e535a25751f5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 35098,
            "upload_time": "2024-12-20T03:02:41",
            "upload_time_iso_8601": "2024-12-20T03:02:41.482713Z",
            "url": "https://files.pythonhosted.org/packages/4a/0c/5ac6499bbad2bf328f53a123d47a3e5cd5eedaf5a727928dbda93b969b38/pyxtream-0.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b7cf83f79d04627e2ac331e0c4368fa9a9042f1f0e4ea02e47228cac775d95a7",
                "md5": "8de1829baf53a160f7603df2d808c972",
                "sha256": "f40155fcdb306edae07b9b01f17d0e02ae98ffae4543d8852a401486c1a90ae5"
            },
            "downloads": -1,
            "filename": "pyxtream-0.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "8de1829baf53a160f7603df2d808c972",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 35525,
            "upload_time": "2024-12-20T03:02:44",
            "upload_time_iso_8601": "2024-12-20T03:02:44.341956Z",
            "url": "https://files.pythonhosted.org/packages/b7/cf/83f79d04627e2ac331e0c4368fa9a9042f1f0e4ea02e47228cac775d95a7/pyxtream-0.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-20 03:02:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "superolmo",
    "github_project": "pyxtream",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pyxtream"
}
        
Elapsed time: 1.50249s