Skip to content

Instantly share code, notes, and snippets.

@MaximeCheramy
Created January 5, 2016 22:04
Show Gist options
  • Save MaximeCheramy/55512e937f114b44281f to your computer and use it in GitHub Desktop.
Save MaximeCheramy/55512e937f114b44281f to your computer and use it in GitHub Desktop.
Liste des chaînes d'un bouquet
import urllib.request
import json
def get(url):
response = urllib.request.urlopen(url)
html = response.read().decode("utf-8")
return json.loads(html)
channels = get("http://mafreebox.freebox.fr/api/v3/tv/channels")["result"]
obj = get("http://mafreebox.freebox.fr/api/v3/tv/bouquets/49/channels")
if obj["success"]:
for r in sorted(obj["result"], key=lambda x: x['number']):
uuid = r["uuid"]
print(r["number"], channels[uuid]["name"])
else:
print("Error")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment