Code Monkey home page Code Monkey logo

py-xtream-codes's Introduction

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

py-xtream-codes's People

Contributors

chazlarson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.