One request.
A full datasheet.
Send a phone name or hardware model code — like Android's Build.MODEL —
and get a structured spec sheet back. Data is read from GSMArena, normalised, and
cached in Redis so repeat lookups are effectively instant. The
Device Catalog is the browsing UI built on top of it.
Worked example
Resolving one phone
What happens when a client asks for a single Samsung model code.
Resolve a model code
GET /api/specs?model=SM-S928B
Cache lookup
Checks Redis for url_map:sm-s928b. A hit returns the stored payload with "cached": true.
Code to name
SM-S928B matches the built-in Samsung pattern: S-series, generation 24, Ultra variant.
Catalog match
The resolved name is scored against the GSMArena quicksearch catalog to find the device page.
Extract
The page is fetched and parsed into sections — Network, Display, Platform, Battery and so on — with a proxy fallback.
Store
Saved under specs:url:<id> plus aliases for the code and full name.
{
"search_query": "SM-S928B",
"search_name": "Samsung Galaxy S24 Ultra",
"matched_device": "Samsung Galaxy S24 Ultra",
"source_url": "https://www.gsmarena.com/samsung_galaxy_s24_ultra-12771.php",
"image": "https://fdn2.gsmarena.com/vv/bigpic/....jpg",
"specifications": {
"Network": { "Technology": "GSM / CDMA / HSPA / EVDO / LTE / 5G" },
"Display": { "Type": "Dynamic AMOLED 2X, 120Hz", "Size": "6.8 inches" }
},
"timing_ms": 2314,
"cached": false
}
Catalog search
What the catalog page calls
The same endpoint powers search, brand filters and the initial grid on /spec.
Filter the cached catalog
GET /api/spec?json=1&q=pixel%209
- Loads cached payloads and keeps entries whose device name or original query contains
pixel 9. - If nothing matches, the query is resolved once through
/api/specsand included with"autoEnriched": true. That is how a new search adds itself to the catalog. - If the cache is empty and no query was given, a few default flagships are resolved so the grid is never blank.
{
"totalInRedis": 42,
"count": 3,
"query": "pixel 9",
"autoEnriched": false,
"devices": [ { "...": "same shape as above" } ]
}
Endpoints
Contracts
Five endpoints cover lookups, the catalog feed, this document, and cache maintenance.
Resolve one device. model is required — a market name or code such as
Pixel 9 Pro XL or HUSKY. Add refresh=1 to skip
the cache. Errors: 400 missing param, 404 not in catalog,
502 parse failed. Responses include timing_ms.
Catalog feed. q filters cached names (minimum 2 characters, triggers
auto-enrichment on a miss). Without json=1 it serves the legacy
server-rendered HTML catalog.
This page. ?json=1 returns the same reference as a machine-readable
JSON document.
Admin. Rebuilds the 25,000+ entry model dictionary. Password-protected.
?action=invalidate-catalog clears the catalog snapshot;
?action=invalidate-specs clears cached specs.
Admin. Clears cache — everything, only payloads, only URL mappings, only the catalog snapshot, or a single model. Password and CSRF protected; three wrong passwords lock the IP for 15 minutes.
Model resolution
From model code to market name
Clients send whatever Android reports. Layers run in order and the first hit wins.
- Built-in table — common codes:
S928 → S24 Ultra,HUSKY → Pixel 8 Pro,CPH2581 → OnePlus 12. - Samsung parser — decodes SM/GT numbers:
SM-S928B → S24 Ultra,SM-A366B → A36,SM-F956B → Z Fold6. - Device dictionary — the synced
device:<code>map covers the long tail. - Catalog scoring — brand-aware token match against quicksearch; one-letter tokens are ignored and exact matches return immediately.
Storage
Redis schema
Every key is written once and reused on subsequent requests.
| Key | Content |
|---|---|
specs:url:<id> | Full JSON payload for one device. Permanent, no expiry. |
url_map:<query> | Lowercased query → GSMArena URL. A device usually has two aliases: code and full name. |
device:<code> | Model code → market name, e.g. device:cph2581 → OnePlus 12. |
cache:gsm_quicksearch_catalog | Catalog snapshot, so matching does not re-download it per request. |
gsm:quicksearch_url | Which snapshot URL is active. |
lock:specs:<query> | Short lock (~22s): concurrent requests for the same uncached phone wait instead of scraping twice. |
Notes & limits
Operational behaviour
- Cache never expires. Cached specs are served as-is until purged via
/resetor bypassed with?refresh=1. - Slow first loads time out. Functions abort after 25s (10s for this page). A
502/404withtiming_msusually means GSMArena was slow — retrying often works. - GET endpoints are public and cross-origin (
Access-Control-Allow-Origin: *). Admin endpoints require the sync password. - Data belongs to GSMArena and is shown for reference with a source link on every device.
