Ich würde gerne die Twitch.tv API auslesen, was auch bisher ganz gut klappt. Allerdings muss ich den Code irgendwie sortieren. Wie funktioniert das?
Das Programm sieht so aus:
Code: Alles auswählen
import urllib2
x = 'https://api.twitch.tv/kraken/channels/' + raw_input('What Channel? ')
print x
url = x
contents = urllib2.urlopen(url)
print contents.read()
Code: Alles auswählen
{"mature":true,"abuse_reported":null,"status":"follow twitch.tv/wolskyy","display_name":"Nadeshot","game":"Call of Duty: Ghosts","delay":0,"language":"en","_id":21130533,"name":"nadeshot","created_at":"2011-03-14T19:59:28Z","updated_at":"2014-10-03T22:54:09Z","logo":"http://static-cdn.jtvnw.net/jtv_user_pictures/nadeshot-profile_image-d68adbe2f9afccf9-300x300.png","banner":"http://static-cdn.jtvnw.net/jtv_user_pictures/nadeshot-channel_header_image-9d87030d73d97092-640x125.png","video_banner":"http://static-cdn.jtvnw.net/jtv_user_pictures/nadeshot-channel_offline_image-a0dde14d2291c4bb-640x360.png","background":null,"profile_banner":null,"profile_banner_background_color":null,"partner":true,"url":"http://www.twitch.tv/nadeshot","views":34961868,"followers":358743,"_links":{"self":"https://api.twitch.tv/kraken/channels/nadeshot","follows":"https://api.twitch.tv/kraken/channels/nadeshot/follows","commercial":"https://api.twitch.tv/kraken/channels/nadeshot/commercial","stream_key":"https://api.twitch.tv/kraken/channels/nadeshot/stream_key","chat":"https://api.twitch.tv/kraken/chat/nadeshot","features":"https://api.twitch.tv/kraken/channels/nadeshot/features","subscriptions":"https://api.twitch.tv/kraken/channels/nadeshot/subscriptions","editors":"https://api.twitch.tv/kraken/channels/nadeshot/editors","teams":"https://api.twitch.tv/kraken/channels/nadeshot/teams","videos":"https://api.twitch.tv/kraken/channels/nadeshot/videos"}}
Mit JSON kenn ich mich null aus und habe mich damit noch nie befasst, kann mir da jemand behilflich sein?
Danke für jede Hilfe!
MfG Luca