Overview
ScreenScraperClient is a low-level HTTP client that communicates with the ScreenScraper API to fetch game metadata and artwork. It handles authentication, request construction, response parsing, and region/language selection.
This is an internal API used by ArtworkService. Most applications should use ArtworkService instead of calling ScreenScraperClient directly.
Constructor
ScreenScraper API credentials object containing:
devId- Developer IDdevPassword- Developer passworduserId- User account ID (optional)userPassword- User account password (optional)
Methods
validateCredentials()
Validates that the configured credentials are accepted by ScreenScraper using thessuserInfos endpoint.
ScreenScraperErrorwith code'auth-failed'if credentials are invalidScreenScraperErrorwith code'config-error'if developer credentials are missing
fetchByHash()
Looks up a game by ROM content hash (MD5).MD5 hash of the ROM file (case-insensitive)
GameLord system ID (e.g., ‘nes’, ‘snes’, ‘genesis’). Automatically mapped to ScreenScraper system IDs.
ScreenScraperGameInfoobject if a match is foundnullif no match is found (404 response)
ScreenScraperErrorwith appropriate error code on failure
Error handling
ScreenScraperClient throwsScreenScraperError instances with structured error codes:
| Error Code | Description |
|---|---|
timeout | Request exceeded 15 second timeout |
auth-failed | Invalid credentials |
config-error | Missing developer credentials in configuration |
rate-limited | Too many requests (429 response) |
network-error | Network connectivity issue |
parse-error | Invalid JSON response from API |
Region and language selection
ScreenScraperClient automatically selects the best region/language variant for localized content: Region priority:- US (
us) - World (
wor) - Europe (
eu) - ScreenScraper (
ss) - Japan (
jp)
- English (
en) - French (
fr) - Spanish (
es) - German (
de) - Portuguese (
pt) - Italian (
it)
Configuration
Developer credentials must be configured via environment variables:Rate limiting
ScreenScraper enforces rate limits. ArtworkService automatically handles rate limiting by spacing requests 1.1 seconds apart. If you use ScreenScraperClient directly, implement your own rate limiting.Source reference
- Source:
apps/desktop/src/main/services/ScreenScraperClient.ts
Related APIs
- ArtworkService - High-level service for artwork syncing
- LibraryService - Game library management