search.search_players()
Search for players
Signature
import vlrdevapi as vlr
result = vlr.search.search_players(
query: str,
timeout: float = 5.0
) -> list[SearchPlayerResult]Parameters
Prop
Type
Return Value
Type: list[SearchPlayerResult]
Returns a list of player search results.
Prop
Type
Examples
Search for Players
import vlrdevapi as vlr
# Search for players
players = vlr.search.search_players("tenz")
print(f"Found {len(players)} players")
for p in players:
print(f"{p.ign} ({p.real_name})")
print(f" Country: {p.country}")
print(f" URL: {p.url}")Get Player Details
import vlrdevapi as vlr
import time
# Search and get full profile
players = vlr.search.search_players("aspas")
for player in players:
print(f"\nFound: {player.ign}")
# Get detailed profile
profile = vlr.players.profile(player.player_id)
if profile:
print(f" Real Name: {profile.real_name}")
print(f" Country: {profile.country}")
if profile.current_teams:
teams = ", ".join(t.name for t in profile.current_teams if t.name)
print(f" Current Teams: {teams}")
time.sleep(1) # Small delay to avoid overwhelming the serverSearch Multiple Players
import vlrdevapi as vlr
import time
player_names = ["tenz", "aspas", "derke"]
for name in player_names:
results = vlr.search.search_players(name)
if results:
top_result = results[0]
print(f"{name}: {top_result.ign} (ID: {top_result.player_id})")
else:
print(f"{name}: No results found")
time.sleep(1) # Small delay to avoid overwhelming the serverError Handling
- Network failures: Returns an empty list
[] - No results found: Returns an empty list
[] - Empty query: Returns an empty list
[]
The function never raises exceptions, making it safe to use without try-catch blocks.
Tips
- Results are enriched with
players.profile()when possible to fill in missing fields - Check list length before accessing results:
if players: - All optional fields can be
None- check before using - Use the
player_idto fetch detailed information withplayers.profile()
Related
Source
Data scraped from: https://www.vlr.gg/search/?q={query}&type=players