Tata Sky IPTV Script generator
A script to generate the m3u playlist containing direct streamable file (.mpd or MPEG-DASH or DASH) based on the channels that the user has subscribed on the Tata Sky portal. You just have to login that's it
Login
The figure shows how the API authenticates any user
Using OTP
Password mechanism also works kinda similar
Explanation of different files used in the code_samples directory
allChannels.py
- This generates a file allChannels.json containing all the channels available on the TataSky platform irrespective of whether the user has subscribed or not. The file has already been included in the repository
constants.py
- This is a list of urls, headers, payloads that might be used anywhere in the other files
jwttoken.py
-
- This contains the logic need for generation of the jwt . This is different from the user access Token generated by the backend upon user login. This is needed to get a license to play each channel url / mpeg dash stream /mpd file The token generated here is appended to the license_url of each channel using ls_session key You can find how it is done in the detailed manner in the file itself
- This can be used independently , just specify the channelId for which you need to get the token and you are good to go The script calls this repeatedly for all channels in the user subscribed/entitlement list
main.py
- This contains the logic for the menu generation for the user. It might be updated constantly utils.py
- This contains the logic for the m3u generation. This will be integrated soon in the main file
TODO
- Add Support for Kodi 19.0 ( See #1 for more info)
- Figure out easy way to solve the issue of playlist need to be updated daily
How to use
- Clone this to your directory using
git clone https://github.com/ForceGT/TSPrivateAPI
- Change to the
code_samples
directory by usingcd code_samples
- Get all the needed requirements for the script from the
requirements.txt
file usingpip install -r requirements.txt
- Simply run
main.py
(the main script) using the following code
python main.py
-
You will get options to login using the different methods, upon successful login a
userDetails.json
file is created which contains important details of the user. TheaccessToken
has to be updated from time to time. To do so run the login logic again. If you delete theuserDetails.json
file you will have to login again so please be careful -
You can generate m3u file by selecting option 3. This generates
allChannelPlaylist.m3u
file in the current directory NOTE: Please run this only after logging in using Step 1 or 2 otherwise the script exits with an error
Playing in Android TV
- You can use Kodi with the PVR Simple IPTV Plugin [doesn't work yet]. The generated m3u file already is in the standard format that can be read by the plugin (WIP)
- You can use Tivimate app to play the m3u playlist too
Playing in Android
- You can use Kodi to play the m3u file(WIP)
- You can play individual channel using Exostreamer Playing individual link : Just open the m3u file generated above in any text editor of your choice and search for your channel. Once you found it, get the channel url(the one that ends with
.mpd
and starts withhttp
) and your license url(The license url is the value of the key#KODIPROP:inputstream.adaptive.license_key=
paramater) Paste the channelurl(mentioned above) in the text field and click on theDRM
button to enter your license url and then click on play. The app automatically remembers this next time if you use it
Playing in a browser (tried with Chrome)
- I personally use Native MPEG-Dash + HLS Playback which doesn't suppport playlists yet
To play a single link/ particular channel
- Open the generated m3u file, and look for the channel you want to play. Get the channel url (ends with
.mpd
) and paste it in the browser - The extension automatically asks for the license url. You should then look for the license url. The license url is the value of the key
#KODIPROP:inputstream.adaptive.license_key=
paramater. Copy the entire url and paste it in the browser NOTE: The ls_session should be copied carefully otherwise the license is not granted
Good points to know
-
The generated m3u file has to be updated daily.If you generated it at 11:00pm today it will expire by 11:00pm tomorrow.You don't need to relogin, just generate the playlist again using command number 3 in the script.
-
If it fails to get jwt for a specific channelId then you must do it manually. Note down the channelId and then use the
jwttoken.py
to generate token for that file and manually edit the m3u file using any text editor How to edit: First run thejwttoken.py
python file usingpython jwttoken.py
Enter the channelId for which you need a token The Token you obtain after running the `above file will be printed in the console. Copy this token and open the m3u file and edit the valueinputstream.adapative.license_url=https://tatasky.irdetto.*****
and append to it ```ls_session```.If your url is ```https://tatasky.****``` then after appending the ```ls_session```, it should now be ```https://tatasky.irdetto.com/****ContentId=4999999&ls_session=Your_Token_Here``` -
You don't need to have a Tata Sky dish, you just need to have a working subscriber id / registered no and/or otp/password (Total 4 ways of logging in using the script) and you should have the channel you want to watch subscribed for the above script to work
-
You need to have basic python knowledge for this