Giter Club home page Giter Club logo

wca-api's Introduction

WCA Results JSON API

Simple way to get the results from the world cube association website (specifically the results from current record singles and averages) in JSON format.

Usage

All results

curl https://wca-proxy.niekh.com/api/v1/records

Single result

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"]
      }
    }
  }
}

Persons & personal records

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"}
    ]
  }
}

Technical details

  • 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.

Development

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

Clearing redis cache (use yarn)

yarn clear-cache

wca-api's People

Contributors

niekh1234 avatar westlifers avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.