Simple way to get the results from the world cube association website (specifically the results from current record singles and averages) in JSON format.
curl https://wca-proxy.niekh.com/api/v1/records
curl https://wca-proxy.niekh.com/api/v1/records/3x3x3
Sample response
{
"record": {
"event": "3x3x3 Cube",
"slug": "3x3x3",
"records": {
"single": {
"name": "Yusheng Du (杜宇生)",
"n": "3.47"
},
"average": {
"name": "Yiheng Wang (王艺衡)",
"n": "4.69",
"attempts": ["3.90", "4.35", "4.41", "5.31"]
}
}
}
}
curl https://wca-proxy.niekh.com/api/v1/persons/2009ZEMD01
Sample response
{
"person": {
"id": "2009ZEMD01",
"name": "Feliks Zemdegs",
"country": "Australia",
"sex": "Male",
"competitions": 135,
"successfullAttempts": 9303,
"personalRecords": {
"3x3x3-cube": {
"event": "3x3x3 Cube",
"single": {
"time": "4.16",
"nationalRecord": "2",
"continentalRecord": "2",
"worldRecord": "11"
},
"average": {
"time": "5.53",
"nationalRecord": "1",
"continentalRecord": "1",
"worldRecord": "8"
}
},
If there are more than 1 person searched
curl https://wca-proxy.niekh.com/api/v1/persons/jack
you shall get a response like this:
Sample response
{
"person":{
"total":1048,
"rows":[
{"name":"Adam Jack Harrison","wca_id":"2022HARR24"},
{"name":"Aiden Lee Jackson","wca_id":"2022JACK04"},
{"name":"Alix Jack","wca_id":"2016JACK05"},
{"name":"Archie Jack Crebbin","wca_id":"2019CREB01"},
{"name":"Ash Jackson Duffy","wca_id":"2019DUFF01"},
{"name":"Beau Jackson","wca_id":"2022JACK02"},
{"name":"Ben Jackson","wca_id":"2015JACK02"},
{"name":"Ben Jackson","wca_id":"2021JACK01"},
{"name":"Benjamin Jackson","wca_id":"2018JACK02"},
{"name":"Benjamin Jackson","wca_id":"2020JACK01"}
]
}
}
- I'm using redis to cache the results for 1 day. I don't want to stress the WCA website too much.
- The results are fetched from the WCA website using cheerio.
Make sure to copy the .env.example
file to .env
and fill in the correct values.
You can spawn a local redis instance using docker:
docker-compose up -d
yarn clear-cache