Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib.request
- import json
- kasutajanimi = input("Oma twitch.tv channeli nimi: ")
- loen = urllib.request.urlopen("https://api.twitch.tv/kraken/users/"+kasutajanimi+"/follows/channels").read()
- json1 = json.loads(loen.decode('utf-8'))
- channels_followed = (json1.get("_total"))
- print(channels_followed)
- for i in range(int(channels_followed)):
- channel = ((json1.get("follows")[i].get("channel").get("name")))
- loen2 = urllib.request.urlopen("https://api.twitch.tv/kraken/streams/"+channel).read()
- json2 = json.loads(loen2.decode('utf-8'))
- if str(json2.get("stream")) == "None":
- print("")
- else:
- print(json2.get("stream").get("game"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement