Skip to content

Python module to interact with Xtream-Codes IPTV servers

License

Notifications You must be signed in to change notification settings

chazlarson/py-xtream-codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

py-xtream-codes

Python module to interact with Xtream-Codes IPTV servers

https://forum.xtream-codes.com/topic/3511-how-to-player-api-v2/

Initialize:

import xtream

x = xtream

# Iris
x.server   = config.provider['server']
x.username = config.provider['username']
x.password = config.provider['password']

r = x.authenticate()

Authentication

r = x.authenticate()

data = r.json() 

returns:

{  
   "user_info":{  
      "username":"11111111",
      "password":"22222222",
      "message":"Welcome back my friends",
      "auth":1,
      "status":"Active",
      "exp_date":"1558621852",
      "is_trial":"0",
      "active_cons":"0",
      "created_at":"1542987052",
      "max_connections":"2",
      "allowed_output_formats":[  
         "m3u8",
         "ts",
         "rtmp"
      ]
   },
   "server_info":{  
      "url":"111.222.333.444",
      "port":"83",
      "https_port":"85",
      "server_protocol":"http",
      "rtmp_port":"84",
      "timezone":"Europe\/London",
      "timestamp_now":1545170300,
      "time_now":"2018-12-18 21:58:20"
   }
}

Streams

Three types of streams:

liveType = "Live"
vodType = "VOD"
seriesType = "Series"

Stream Categories

r = x.categories(x.liveType)
live_category_data = r.json()

r = x.categories(x.vodType)
vod_category_data = r.json() 

r = x.categories(x.seriesType)
series_category_data = r.json() 

Streams

r = x.streams(x.liveType)
live_stream_data = r.json()

r = x.streams(x.vodType)
vod_stream_data = r.json()

r = x.streams(x.seriesType)
series_stream_data = r.json()

Streams by Category

r = x.streamsByCategory(x.liveType, live_category_data[0]['category_id'])
live_stream_data = r.json()

r = x.streamsByCategory(x.vodType, vod_category_data[0]['category_id'])
vod_stream_data = r.json()

r = x.streamsByCategory(x.seriesType, series_category_data[0]['category_id'])
series_stream_data = r.json()

Series Info

r = x.Series_info_by_ID(series_stream_data[0]['id'])
series_info_data = r.json()

GET VOD Info

r = x.VOD_info_by_ID(vod_stream_data[0]['num'])
vod_info_data = r.json()

GET short_epg for LIVE Streams (same as stalker portal, prints the next X EPG that will play soon)

"Limit" is count of EPG listings wanted

r = x.live_epg_by_stream(live_stream_data[0]['stream_id'])
live_epg_data = r.json()

r = x.live_epg_by_stream_and_limit(live_stream_data[0]['stream_id'], 24)
live_epg_data = r.json()

GET ALL EPG for LIVE Streams (same as stalker portal, but it will print all epg listings regardless of the day)

r = x.all_live_epg_by_stream(live_stream_data[0]['stream_id'])
live_epg_data = r.json()

Full EPG List for all Streams

r = x.all_epg()
live_epg_data = r.json()

Quickstart

  1. Clone the repo locally
  2. pip install requests
  3. Copy config.py.example to config.py.
  4. edit config.py as required
  5. run python xtream-testing.py

About

Python module to interact with Xtream-Codes IPTV servers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages