3

Player Stats Spreadsheet

Comments:
Threaded Linear
#1
ariLMFAO

Should be every player who has played a VLR game not sure if my program missed some.
https://docs.google.com/spreadsheets/d/1dWFdY6TL0_asIcBHr1y6kr7wOpGb4VWd3Nvdi_vAF80/edit?gid=190653449#gid=190653449
Do what you will with this information, i made it for fun

#2
benmaimoon
7
Frags
+

would be better if you remove tier 5 players

#3
ariLMFAO
0
Frags
+

im making a franchised one soon

#4
benmaimoon
0
Frags
+

im waiting sir 😼🧐

#17
ariLMFAO
0
Frags
+

done

#5
invert
2
Frags
+

yay and malibu next to each other #2GOATS

#6
ariLMFAO
-2
Frags
+

real

#7
Denggysaurus
0
Frags
+

Is team just the most recent team they've been on?

#8
Aayan
0
Frags
+

holy shit you're dankness

#12
ariLMFAO
0
Frags
+

How have you got this information

#15
Aayan
0
Frags
+

I saw on the spreadsheet your discord was ari.aim and that rung a bell somewhere
so I checked Refraction's discord server eventually after realising and yeah, there you were

#16
ariLMFAO
0
Frags
+

pretty funny lol

#9
Convoy
1
Frags
+

how the fuck did you scrap the information

#11
yukky
0
Frags
+

Yeahhhhhhhhh you got me thinking with this comment, just coded it. Was pretty fun

The below code gives me these all time avg stats for flor though:

{'player_name': 'florescent', 'rnd': 451, 'rating': 1.5, 'acs': 284.03, 'kd': 1.9, 'adr': 184.59, 'kast': 81, 'kpr': 1.03, 'apr': 0.38, 'fkpr': 0.11, 'fdpr': 0.07, 'k': 463, 'd': 302, 'a': 99, 'fk': 90, 'fd': 52}

import requests
from bs4 import BeautifulSoup

player_stats_template = {
    "player_name": "",  # Player's name
    "rnd": 0,           # Number of rounds played
    "rating": 0.0,      # Player rating
    "acs": 0.0,         # Average combat score
    "kd": 0.0,          # Kill/Death ratio
    "adr": 0.0,         # Average damage per round
    "kast": 0,          # Kill, Assist, Survive, or Traded percentage
    "kpr": 0.0,         # Kills per round
    "apr": 0.0,         # Assists per round
    "fkpr": 0.0,        # First kills per round
    "fdpr": 0.0,        # First deaths per round
    "k": 0,             # Total kills
    "d": 0,             # Total deaths
    "a": 0,             # Total assists
    "fk": 0,            # Total first kills
    "fd": 0             # Total first deaths
}

TOTAL_MAX_PLAYERS = 48850  # total number of players on vlr to potentially scrape

def get_player_data(player_num):
    url = f"https://www.vlr.gg/player/{player_num}/?timespan=all"
    response = requests.get(url)

    if response.status_code != 200:
        return None

    soup = BeautifulSoup(response.content, 'html.parser')

    # player name ^-^
    player_name_tag = soup.find('h1', class_='wf-title')
    player_name = player_name_tag.text.strip() if player_name_tag else player_num
    player_stats_template["player_name"] = player_name

    accumulator = {key: 0 for key in player_stats_template if key != "player_name"}
    num_rows = 0 

    stat_keys = list(player_stats_template.keys())[1:] 

    # get stats table
    table = soup.find_all('table', class_='wf-table')
    for ratings_tag in table:
        tbody = ratings_tag.find('tbody')
        if tbody:
            rows = tbody.find_all('tr')
            for row in rows:
                # extract all td that do not have a style attribute (no agent img & use % )
                cols = row.find_all('td')
                row_values = [col.text.strip() for col in cols if not col.has_attr('style')]

                # If the number of columns matches our expected stats, process the row
                if row_values and len(row_values) == len(stat_keys):
                    for i, key in enumerate(stat_keys):
                        # Accumulate values based on the key's expected data type
                        if isinstance(player_stats_template[key], int):
                            accumulator[key] += int(row_values[i].replace('%', ''))
                        else:
                            accumulator[key] += float(row_values[i])
                    num_rows += 1

    # calculate averages
    if num_rows > 0:
        for key in accumulator:
            if isinstance(player_stats_template[key], int):
                # for intege use floor division
                player_stats_template[key] = accumulator[key] // num_rows
            else:
                # for floating point round to two decimal places
                player_stats_template[key] = round(accumulator[key] / num_rows, 2)

    return player_stats_template

# florescent
player_num = '17976'
player_data = get_player_data(player_num)
if player_data:
    print(player_data)

# Uncomment the code below to iterate through every player up to TOTAL_MAX_PLAYERS
# for i in range(1, TOTAL_MAX_PLAYERS + 1):
#     player_num = str(i)  # Convert player number to string for URL construction
#     player_data = get_player_data(player_num)
#     if player_data:
#         print(player_data)
#         break  # Stop after finding and printing the first valid player data
#21
Convoy
0
Frags
+

ahhh right thanks mate

#10
yukky
0
Frags
+

Is this stats for their current team only or all time?

If its all time I think its off btw cause flors avg rating all time rating is 1.50

ratings = [1.41, 1.37, 1.28, 1.29, 1.39, 1.13, 1.14, 1.51, 1.17, 1.37, 1.58, 1.42, 1.35, 1.77, 1.69, 1.71, 1.72, 1.53, 1.67, 1.12, 1.63, 2.12, 1.42, 2.23]
total_sum = sum(ratings)
count = len(ratings)
average_rating = total_sum / count
print(average_rating) #1.5008333333333332
#13
usseum
0
Frags
+

i think kast% is important stat there

#14
ariLMFAO
0
Frags
+

I’ll add this

#18
number2_cNed_fan
0
Frags
+

your program missed me 😔

#19
ariLMFAO
0
Frags
+

https://i.imgur.com/PsknqKC.png

#20
number2_cNed_fan
0
Frags
+

https://www.vlr.gg/player/47622/cataboo

  • Preview
  • Edit
› check that that your post follows the forum rules and guidelines or get formatting help
Sign up or log in to post a comment