Skip to content

Commit

Permalink
feat(scrape.py): extract agent names and rounds played for detailed p…
Browse files Browse the repository at this point in the history
…layer stats
  • Loading branch information
axsddlr committed Sep 16, 2024
1 parent 0e5dcd3 commit 9b80a1c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ def vlr_stats(region: str, timespan: str):
except Exception:
org = "N/A"

# agents = [agents.css_first("img").attributes['src'] for agents in item.css("td.mod-agents")]
# get agent names
agents = [
agents.attributes["src"].split("/")[-1].split(".")[0]
for agents in item.css("td.mod-agents img")
]

# get all td items from mod-color-sq class
color_sq = [stats.text() for stats in item.css("td.mod-color-sq")]
Expand All @@ -243,10 +247,15 @@ def vlr_stats(region: str, timespan: str):
hs = color_sq[9]
cl = color_sq[10]

# Get the rounds played
rnd = item.css_first("td.mod-rnd").text()

result.append(
{
"player": player_name,
"org": org,
"agents": agents,
"rounds_played": rnd,
"rating": rat,
"average_combat_score": acs,
"kill_deaths": kd,
Expand Down

0 comments on commit 9b80a1c

Please sign in to comment.