Skip to content

sht2017/iptv

Repository files navigation

Testing codecov GitHub License

English | 中文

IPTV Simulate

Utilities for China Telecom's IPTV authentication with an example.

Tested in Hubei

How does it work?

The encryption and authorization algorithm (package located in /src/epg/) is optimized and rewritten based on the best practices of Python in a modern way. Original algorithms have come from reverse engineering of the app on my STB.

The core idea of the example project is to give up on simulating each package, which took a complex analysis and made it impossible to fit different cases. I eventually chose to use the same way originally on the STB, a browser. It's way more easy to debug and control.

For that, I implemented the package /src/browser/ to automatically finish the authorization and receive EPG. Specifically, /src/browser/browser.py provides a browser interface which allows me to interact with it and will auto-quit once the destination address is hit. And the /src/browser/remote_injector/ provides a few classes and functions to inject Python methods and classes to the browser as JavaScript.

How to use?

requirement: git, python>=3.10 (tested on Python 3.12), python3-pip, python3-venv

⚠️ the version of the playwright currently freezes to 1.44.0 because there is a critical bug on the latest version (1.45.0) which leads to failure. (The /src/browser/remote_injector/template/invokeRemoteFunction.js would successfully be injected via /src/browser/remote_injector/inject.py but won't work)

solved

  • linux

    • Debian-like (Debian, Ubuntu, etc...)

      • Setup

        sudo apt-get update
        sudo apt-get install git python3 python3-pip python3-venv -y
        git clone https://github.com/sht2017/iptv.git
        cd iptv
        ./setup.py
      • Run Example Project

        ⚠️ /config.yaml is required

        ℹ️ You can create it as in /config.example.yaml

        source .venv/bin/activate
        PYTHONPATH="$(pwd)/src:${PYTHONPATH}" python3 src/custom/main.py

        Go check /db.json and enjoy

  • Windows

    • CMD

      • Setup

        ⚠️ winget might not available on your system

        winget install --id Git.Git -e --source winget
        winget install python3 --source winget
        git clone https://github.com/sht2017/iptv.git
        cd iptv
        python setup.py
      • Run Example Project

        ⚠️ /config.yaml is required

        ℹ️ You can create it as in /config.example.yaml

        .venv\Scripts\activate
        set PYTHONPATH=%cd%\src;%PYTHONPATH%
        python src/custom/main.py

        Go check /db.json and enjoy

Development

for utility libs check docstring in src/epg, suggest to modify in /src/custom/.

Acknowledgement (not listed in order)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published