- In your browser, go the URL where you can find the data that you want. For example,
https://www.fotmob.com/leagues/126/stats/premier-division?season=2024
- Use the browser's "Inspect" feature and "Network" tab to find the right
GET
request. You should be able to tell which request is the right one by looking to see if there is a detailed JSON response in the "Response" tab. - Right click on the request and copy the CURL command.
- Go to
https://curlconverter.com
, copy the CURL command into the "curl command" box at the top of the page with "R > httr2" (or "R > httr") selected.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(rvest) | |
library(janitor) | |
page <- read_html('https://mychiptime.com/searchevent.php?id=15902#%206') | |
raw_table <- page |> html_table() |> pluck(1) | |
melted_table <- raw_table |> | |
mutate( | |
row = row_number() |
Looking at the biggest differences in 2024/25 xG in data scraped right after the match and then later updated to account for ball height and defender positioning.
library(dplyr)
library(tibble)
joined_data <- readRDS('joined_fb_match_shooting_big5_20241201.rds')
Here's some fake data showing how shot logs might look for a soccer match.
library(tibble)
library(dplyr)
df <- tibble::tibble(
shot_id = seq.int(1, 8),
minute = c(7, 13, 25, 30, 41, 44, 58, 78), ## doesn't matter, just for illustrative purposes
Setup.
library(googleway)
library(dplyr)
library(tibble)
DATA_DIR <- "path/to/dir"
dir.create(DATA_DIR, showWarnings = FALSE, recursive = TRUE)
library(rvest)
library(tibble)
url <- 'https://fbref.com/en/comps/Big5/Big-5-European-Leagues-Stats'
page <- read_html(url)
team_elements <- page |>
html_elements('table') |>
library(gh)
library(purrr)
library(dplyr)
token <- Sys.getenv("GITHUB_PAT")
REPO <- "my-repo"
OWNER <- "me"
runs <- gh::gh(
Full set of fotmob shot releases here: https://github.com/JaseZiv/worldfootballR_data/releases/tag/fotmob_match_details
raw_shots <- readr::read_csv('https://github.com/JaseZiv/worldfootballR_data/releases/download/fotmob_match_details/47_match_details.csv')
#> Rows: 28667 Columns: 43
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (18): league_name, league_round_name, parent_league_season, match_time_u...
#> dbl (22): match_id, match_round, league_id, parent_league_id, home_team_id, ...
Raw data pull
library(StatsBombR)
library(worldfootballR)
library(dplyr)
library(janitor)
library(tibble)
NewerOlder