-
Notifications
You must be signed in to change notification settings - Fork 2
/
robuxcalc.py
28 lines (22 loc) · 978 Bytes
/
robuxcalc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import requests, time
total = 0
cookie = str(input("Enter your cookie: "))
with requests.Session() as session:
session.cookies['.ROBLOSECURITY'] = cookie
userId = session.get('https://www.roblox.com/mobileapi/userinfo').json()['UserID']
def main():
global total
cursor = ''
while cursor != None:
response = session.get(f'https://economy.roblox.com/v2/users/{userId}/transactions?transactionType=Purchase&limit=100&cursor={cursor}').json()
if 'data' in response:
print(f'Found another {len(response["data"])} purchases')
for purchase in response['data']:
if purchase['currency']['type'] == 'Robux':
total += purchase['currency']['amount']
cursor = response['nextPageCursor']
else:
time.sleep(30)
main()
total = str(total).replace('-', '')
print(f'\nYou have {total} robux spent in total')