Skip to content
This repository has been archived by the owner on Mar 3, 2018. It is now read-only.

Commit

Permalink
Add client_id to request urls
Browse files Browse the repository at this point in the history
Resolves #10
  • Loading branch information
Rolandas Barysas committed Sep 17, 2016
1 parent e51377a commit a63fbf4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def fetch_followed_channels(self, username):
try:
self.followed_channels = []

self.f = urllib.urlopen("https://api.twitch.tv/kraken/users/{0}/follows/channels?direction=DESC&limit=100&offset=0&sortby=created_at".format(username))
self.f = urllib.urlopen("https://api.twitch.tv/kraken/users/{0}/follows/channels?client_id=oe77z9pq798tln7ngil0exwr0mun4hj&direction=DESC&limit=100&offset=0&sortby=created_at".format(username))
self.data = json.loads(self.f.read())

# Return 404 if user does not exist
Expand All @@ -31,7 +31,7 @@ def fetch_followed_channels(self, username):
self.pages = (self.data['_total'] - 1) / 100
for page in range(0, self.pages + 1):
if page != 0:
self.f = urllib.urlopen("https://api.twitch.tv/kraken/users/{0}/follows/channels?direction=DESC&limit=100&offset={1}&sortby=created_at".format(username, (page * 100)))
self.f = urllib.urlopen("https://api.twitch.tv/kraken/users/{0}/follows/channels?client_id=oe77z9pq798tln7ngil0exwr0mun4hj&direction=DESC&limit=100&offset={1}&sortby=created_at".format(username, (page * 100)))
self.data = json.loads(self.f.read())

for channel in self.data['follows']:
Expand All @@ -54,7 +54,7 @@ def fetch_live_streams(self, channels):
self.offset = self.channels_count
self.channels_offset = channels[(page * 75):self.offset]

self.f = urllib.urlopen("https://api.twitch.tv/kraken/streams?channel={0}".format(','.join(self.channels_offset)))
self.f = urllib.urlopen("https://api.twitch.tv/kraken/streams?client_id=oe77z9pq798tln7ngil0exwr0mun4hj&channel={0}".format(','.join(self.channels_offset)))
self.data = json.loads(self.f.read())

for stream in self.data['streams']:
Expand Down

0 comments on commit a63fbf4

Please sign in to comment.