VlrClient

Struct VlrClient 

Source
pub struct VlrClient { /* private fields */ }
Expand description

The main entry point for interacting with VLR.gg.

VlrClient wraps a [reqwest::Client] and exposes methods to fetch events, match lists, match details, player profiles, and player match histories.

§Examples

use vlr_scraper::{AgentStatsTimespan, EventType, Region, VlrClient};

let client = VlrClient::new();
let events = client
    .get_events(EventType::Upcoming, Region::All, 1)
    .await?;
println!("Found {} events", events.events.len());

// Fetch a player profile
let player = client.get_player(17323, Default::default()).await?;
println!("{} ({:?})", player.info.name, player.info.country);

Implementations§

Source§

impl VlrClient

Source

pub fn new() -> Self

Create a new client with default settings.

Uses a default [reqwest::Client] with no custom configuration. For custom timeouts, proxies, or headers, use VlrClient::with_client.

Source

pub fn with_client(client: Client) -> Self

Create a new client using the provided [reqwest::Client].

Use this when you need to configure timeouts, proxies, headers, or other HTTP-level settings.

§Examples
use vlr_scraper::VlrClient;

let http = reqwest::Client::builder()
    .timeout(std::time::Duration::from_secs(10))
    .build()
    .unwrap();
let client = VlrClient::with_client(http);
Source

pub async fn get_events( &self, event_type: EventType, region: Region, page: u8, ) -> Result<EventsData>

Fetch a paginated list of events, filtered by type and region.

Returns an EventsData containing a page of Event entries together with pagination info (page and total_pages). Each event includes its status, region, title, dates, icon URL, and price tier.

§Arguments
§Examples
use vlr_scraper::{EventType, Region, VlrClient};

let client = VlrClient::new();
let data = client
    .get_events(EventType::Upcoming, Region::Europe, 1)
    .await?;
for event in &data.events {
    println!("[{}] {} ({})", event.status, event.title, event.dates);
}
Source

pub async fn get_event_matchlist(&self, event_id: u32) -> Result<EventMatchList>

Fetch all matches belonging to an event.

Returns an EventMatchList (a Vec<EventMatchListItem>) where each item contains the match ID, slug, date/time, participating teams with scores, tags, and event series text.

§Arguments
  • event_id - The VLR.gg event ID (found in Event::id).
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let matches = client.get_event_matchlist(2095).await?;
for m in &matches {
    let teams: Vec<_> = m.teams.iter().map(|t| t.name.as_str()).collect();
    println!("{} — {}", teams.join(" vs "), m.event_series_text);
}
Source

pub async fn get_match(&self, match_id: u32) -> Result<Match>

Fetch full details for a specific match by ID.

Returns a Match containing:

  • MatchHeader — event info, date, and team names/scores
  • Live streams and VOD links as MatchStream entries
  • Per-map MatchGame data with team scores, player stats, and round-by-round outcomes
§Arguments
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let m = client.get_match(429519).await?;
println!("{} — {}", m.header.event_title, m.header.event_series_name);
for game in &m.games {
    println!(
        "  {} — {} vs {}",
        game.map, game.teams[0].name, game.teams[1].name
    );
}
Source

pub async fn get_player_matchlist( &self, player_id: u32, page: u8, ) -> Result<PlayerMatchList>

Fetch a paginated list of matches a player has participated in.

Returns a PlayerMatchList (a Vec<PlayerMatchListItem>) where each entry contains the match ID, league name and icon, participating teams with scores, VOD links, and a match start timestamp.

§Arguments
  • player_id - The VLR.gg player ID.
  • page - Page number (1-indexed).
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let matches = client.get_player_matchlist(17323, 1).await?;
for m in &matches {
    let teams: Vec<_> = m.teams.iter().map(|t| t.name.as_str()).collect();
    println!("[{}] {}", m.league_name, teams.join(" vs "));
}
Source

pub async fn get_player( &self, player_id: u32, timespan: AgentStatsTimespan, ) -> Result<Player>

Fetch a complete player profile including info, teams, agent stats, news, and event placements.

The returned Player contains:

  • PlayerInfo — name, real name, avatar URL, country/country code, and social links
  • Current and past PlayerTeam entries with team ID, name, logo, and join info
  • PlayerAgentStats for the given timespan (rating, ACS, K/D, ADR, KAST, etc.)
  • Recent PlayerNewsItem articles mentioning the player
  • EventPlacement history with per-stage results and total winnings
§Arguments
  • player_id - The VLR.gg player ID.
  • timespan - Time window for agent statistics (see AgentStatsTimespan).
§Examples
use vlr_scraper::{AgentStatsTimespan, VlrClient};

let client = VlrClient::new();
let player = client.get_player(17323, AgentStatsTimespan::All).await?;

println!("{} ({:?})", player.info.name, player.info.country);
for team in &player.current_teams {
    println!("  team: {}", team.name);
}
for stat in &player.agent_stats {
    println!(
        "  {} — rating {:.2}, K/D {:.2}",
        stat.agent, stat.rating, stat.kd
    );
}
Source

pub async fn get_team_matchlist( &self, team_id: u32, page: u8, ) -> Result<Vec<MatchItem>>

Fetch a paginated list of matches a team has participated in.

Returns a Vec<MatchItem> where each entry contains the match ID, league name and icon, participating teams with scores, VOD links, and a match start timestamp.

§Arguments
  • team_id - The VLR.gg team ID.
  • page - Page number (1-indexed).
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let matches = client.get_team_matchlist(6530, 1).await?;
for m in &matches {
    let teams: Vec<_> = m.teams.iter().map(|t| t.name.as_str()).collect();
    println!("[{}] {}", m.league_name, teams.join(" vs "));
}
Source

pub async fn get_team_transactions( &self, team_id: u32, ) -> Result<Vec<TeamTransaction>>

Fetch a team’s roster transaction history (joins, leaves, inactive changes).

Returns a Vec<TeamTransaction> where each entry contains the date, action type, player info (id, alias, real name, country code), position, and an optional reference URL.

§Arguments
  • team_id - The VLR.gg team ID (found in team page URLs).
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let transactions = client.get_team_transactions(6530).await?;
for txn in &transactions {
    println!(
        "{:?} — {} {} ({})",
        txn.date, txn.action, txn.player_alias, txn.position
    );
}
Source

pub async fn get_team(&self, team_id: u32) -> Result<Team>

Fetch a complete team profile including info, roster, event placements, and total winnings.

The returned Team contains:

  • TeamInfo — name, tag, logo URL, country/country code, and social links
  • TeamRosterMember entries with player/staff info, roles, and captain status
  • EventPlacement history with stage results and prize earnings
  • Total career winnings as an optional string
§Arguments
  • team_id - The VLR.gg team ID (found in team page URLs).
§Examples
use vlr_scraper::VlrClient;

let client = VlrClient::new();
let team = client.get_team(6530).await?;
println!("{} ({:?})", team.info.name, team.info.tag);
for member in &team.roster {
    println!("  {} — {}", member.alias, member.role);
}

Trait Implementations§

Source§

impl Default for VlrClient

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more