Skip to main content

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, so its compatibility with Hypnotix takes precedence.

Installing

Installing pyxtream is done using pip3.

pip3 install pyxtream

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

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.

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.

xt.get_series_info_by_id(series_obj)

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

Functional Test

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

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.

Applications using PyXtream

Applications using PyXtream PYPI package

Applications using PyXtream files

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

Follows the Semantic Versioning from https://semver.org/

  • 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
2026-04-03 0.8.0 - Added more PyTest functions
- Refactored index.html to better show cards
- Refactored pyxtream.py with types
- Removed cli progress bar
- Fixed issue with loading series max298
- Fixed empty logo issue max298
2025-02-17 0.7.3 - Added Initial PyTest and Coverage
- Added timestamp field "added" to Series to match channels "added" field
- Added string field "url" to Series to quickly get the series download address
- Added new API "get_last_7days()" returns the last added streams in the last 7 days in JSON format
- Added new API "get_download_progress()" returns information on the current download stream in JSON format
- Changed internal function _load_series_info_by_id_from_provider to allow returned value to change to JSON
- Changed search_stream function to only search in specific collections
- Refactored "rest_api.py" to make it easier to extend in the future
- Added new rest API
- Changed to Poetry environment
- Changed Functional Test to test loading series information
- Changed sample index.html to test more features
2024-09-02 0.7.2 - Added missing request package to setup.py
- Refactored the search stream function and now, it can search for a specific stream type
- Refactored the download stream function
- Refactored the _get_request function and removed the call to the sleep function
- Added functional test to get series json output from a series_id
- Added functional test to get EPG for a specific stream ID
- Added xtream account expiration date printed on the console during authentication
- Improved results with the Flask HTML page and differentiating between movies and series
- Improved code readability
2024-05-21 0.7.1 - Fixed missing jsonschema package
- Fixed provider name in functional_test
- Improved print out of connection attempts
- Added method to read latest changes in functional_test
2023-11-08 0.7.0 - Added Schema Validator
- Added Channel Age
- Added list of movies added in the last 30 and 7 days
- Updated code based on PyLint
- Fixed Flask package to be optional 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
- Added a loop when attempting to connect to the provider
- Cleaned up some print lines
2021-08-19 0.5.0 - Added method to gracefully handle connection errors
- Added setting to not load adult content
- Added sorting by stream name
- Changed the handling of special characters in streams
- Changed print formatting
- Changed index.html webpage to HTML5 and Bootstrap 5
2021-06-19 0.4.0 - Updated to follow PEP8
- Updated Docstrings
2021-06-19 0.3.0 - Added enhanced Home Page with Search Button and Player
- Added case insensitive search
- 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
- Added video download
- Added REST Api
- 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

Interesting content that could be used for future development

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

Metadata

Release files for pyxtream 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyxtream 0.8.0
File Size Uploaded Provenance
pyxtream-0.8.0.tar.gz 41.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyxtream 0.8.0
File Interpreter ABI Platform
pyxtream-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 83.3 kB

Release files / pyxtream-0.8.0.tar.gz

Download URL pyxtream-0.8.0.tar.gz
Size 41.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a8f0cec3a7ecaa0d43f4975566796479d61e3f726c2feb698c9855a28b6973ca
BLAKE2b-256 checksum
How to use checksums
f60fa5dace72a016f85c18b30852f273b19c11f93dbc9eb999d8ed06c4486d1d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.12.3 Linux/6.8.0-101-generic

Release files / pyxtream-0.8.0-py3-none-any.whl

Download URL pyxtream-0.8.0-py3-none-any.whl
Size 41.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
410289825c283a0075776c553818c565af1957bd6d79396303a7ef0fc1e5fee9
BLAKE2b-256 checksum
How to use checksums
cbb9a613205a7008b5749b505296842bc63c3fee6a59b41fac916c9e4ee70f28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.4 CPython/3.12.3 Linux/6.8.0-101-generic

Security for pyxtream 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page