1.0.2 • Published 3 years ago

cricket-api-node v1.0.2

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

Cricket API Node 🏏

Score Test dependencies Status

Build a Live Cricket Score JSON API by using this Node Module.

Requirements 📦

  • Node.js 12X LTS or 14X LTS

Installation 🍔

  • Insall via NPM
npm install cricket-api-node

OR

yarn add cricket-api-node

Usage 📝

  • Get Live Match Score
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 🤓

#Project NameDescription
01Live Cricket Score Static SiteA Simple Scrape Method - Fetch the Live Cricket Score from espncricinfo.com using Nodejs and Cheerio.js
02IPL SpecialCricket API for Get the Live IPL Cricket Score
03Live IPL Score Update on TelegramGet Live IPL cricket Score on Telegram
04Live Cricket Score Wordpress Plugin (JS Version)Get Live Cricket Score on Wordpress site call API using Javascript Fetch API
05Live Cricket Score Wordpress Plugin (Wp Remote URL)Get Live Cricket Score on Wordpress site call API using Wordpress HTTP Remote URL
06PWA Web AppReal-time Live Cricket Score Web app + PWA Built using Nuxt.js

LICENSE 📕

MIT

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago