Cricket API Node 🏏
Build a Live Cricket Score JSON API by using this Node Module.
Requirements 📦
- Node.js 12X LTS or 14X LTS
Installation 🍔
npm install cricket-api-node
OR
yarn add cricket-api-node
Usage 📝
const score = require('cricket-api-node');
score.match('<Live Match URL from cricbuzz>');
This is My Experimenting npm
Module for Build an API using Express.js
const express = require('express');
const cors = require('cors');
const score = require('cricket-api-node');
const app = express();
const port = process.env.PORT || 4000;
app.use(cors());
app.listen(port, function () {
console.log('listening on port ' + port);
});
function customHeaders(req, res, next) {
app.disable('x-powered-by');
res.setHeader('X-Powered-By', 'Live Score API');
next();
}
app.use(customHeaders);
app.get('/', async (req, res) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Headers', 'Access-Control-Allow-Headers,Content-Type,Access-Control-Allow-Methods, Authorization, X-Requested-With');
res.header('Access-Control-Allow-Methods', 'GET');
res.header('X-Frame-Options', 'DENY');
res.header('X-XSS-Protection', '1; mode=block');
res.header('X-Content-Type-Options', 'nosniff');
res.header('Strict-Transport-Security', 'max-age=63072000');
res.header('Content-Type', 'application/json');
const LIVE_MATCH = "<URL OF CRICKET API>";
score.match(LIVE_MATCH).then(live => {
res.send(live);
});
});
API Library 🗃
Disclaimer 🗃
- This is not an Offical CLI tool from Cricbuzz - it's an Unofficial CLI tool and API
- This is for Education Purpose only - use at your own risk on Production Site
All Credits Goes to https://www.cricbuzz.com/
My other Projects 🤓
LICENSE 📕
MIT