Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Free Live Cricket Score JSON API (Node.js Version) - Get data from Cricbuzz - Live Cricket Score API.

License

Notifications You must be signed in to change notification settings

sanwebinfo/cricket-api-nodejs

Repository files navigation

Free Cricket API 🏏

Github Workflow

API is not working due to the Cricbuzz Mobile site being Fully Redesigned - The full Site Structure was Changed it's a bit complex to get data - Please Consider using the Python Cricket API Version - https://github.com/sanwebinfo/cricket-api

Node.js Version - Get Live Cricket Score data from Cricbuzz.com

This is an unofficial API and not Linked or Partnered with Any Brands/Company.

How it Works? 🤔

Build using Node.js and cheerio.js - using cheerio for Scrape the data and Converted in JSON API with the Help of Express Server.

Everything is scraped live and shown to end users in realtime.

API URL

  • Live Match Data - http://localhost:3000/live
  • Get Live data from the URL - http://localhost:3000/score?url=<Live Match URL>

Note

API Caching, CORS and API Rate limit Was Enabled by default you can update the settings accoding to your usage - Files are Located in /routes/ folder

Requirements 📑

  • Server With Latest LTS Node.JS Support and Nginx (For Self Host)
  • HTTPS for Secure SSL Connection

(OR)

  • use Vercel or Heroku Free Cloud Hosting

Installation and Development 📥

  • Download the Clone the Repo
git clone https://github.com/sanwebinfo/cricket-api-nodejs.git
cd cricket-api-nodejs
  • install Node Modules via yarn
yarn
  • Test Locally
yarn dev
  • Production
yarn start

Usage 🍟

  • Get the Live Match Score URL from - https://www.cricbuzz.com/cricket-match/live-scores
  • Enter them Directly or replace www with m

Example 📋

http://localhost:3000/score?url=https://www.cricbuzz.com/live-cricket-scores/30524/53rd-match-indian-premier-league-2020

(OR)

  • Update the Match URL on /utlis/app.json File
http://localhost:3000/live

Free Hosting 😍

  • Deploy on Vercel

Deploy with Vercel

Docker 🐬

Keep Running the Node JS API in Docker

  • Update the .dockerfile before build - Modify it according to your Needs
FROM node:18-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn install
COPY . .
EXPOSE 3000
CMD [ "node", "index.js" ]
## Build image
docker build . -t="cricket-api-nodejs"

## List the image
docker image ls

## Create and Test Container
docker run -d -p 3000:3000 --name cricket cricket-api-nodejs
docker container ps
docker stop (containerID)

## Run the container forever
docker run -d --restart=always -p 3000:3000 --name cricket cricket-api-nodejs

## List Hidden container if error exists
docker ps -a

## other commands
docker logs (containerID)
docker stop (containerID)
docker rm (containerid)
docker docker rmi (imageid)
docker image prune
docker builder prune --all -f
docker system prune --all
docker rm $(docker ps -all -q)
docker rmi $(docker image ls -q)

Contributing 🙌

Your PR's are Welcome

Disclaimer 🗃

  • This is not an Offical API from Cricbuzz - it's an Unofficial API
  • This is for Education Purpose only - use at your own risk on Production Site

All Credits Goes to https://www.cricbuzz.com/

LICENSE 📕

MIT