# License: GNU Affero General Public License v3.0
import requests
import urllib.parse
def scrape(player_name):
player_url = urllib.parse.quote(player_name)
url = f'https://ddnet.org/players/?json2={player_url}'
data = requests.get(url).json()
return data
def get_data(data):
total_points = []
points = []
for category in data['types']:
category = data['types'][category]
for map in category['maps']:
maps = category['maps']
total_points.append(maps[map]['points'] * maps[map]['finishes'])
if 'rank' in maps[map]:
points.append(maps[map]['points'])
return total_points, points
player_name = "" # Change this
data = scrape(player_name)
total_points, points = get_data(data)
total_points = sum(total_points)
points = sum(points)
print(f"{player_name}: {points} | {total_points}")
heres the wonderful script xd (edited)