Created
January 5, 2016 22:04
-
-
Save MaximeCheramy/55512e937f114b44281f to your computer and use it in GitHub Desktop.
Liste des chaînes d'un bouquet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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