fggkyle

lol

Aug 23rd, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. import requests
  2.  
  3. def check_new_runs():
  4.     maximum = 200
  5.     offset = 0
  6.     url = 'https://www.speedrun.com/api'
  7.  
  8.     original_params = (
  9.         ('game', '268zey6p'),
  10.         ('category', 'rkl09wkn'),
  11.         ('status', 'verified'),
  12.         ('max', str(maximum)),
  13.         ('offset', str(offset))
  14.     )
  15.  
  16.     uri = None
  17.     count = 1
  18.  
  19.     data = requests.get(f'{url}/v1/runs', params=original_params)
  20.     runs = data.json()
  21.  
  22.     while(True):
  23.         if count > 1:
  24.             data = requests.get(runs['pagination']['links'][0]['uri'])
  25.             runs = data.json()
  26.  
  27.         for run in runs['data']:
  28.             print(count, run['date'])
  29.             count += 1
  30.  
  31.         if runs['pagination']['size'] < maximum:
  32.             break
Advertisement
Add Comment
Please, Sign In to add comment