Coder Social home page Coder Social logo

jvlomazzi / hltv-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dajk/hltv-api

0.0 0.0 0.0 994 KB

DEPRECATED: An unofficial JSON api for popular CS:GO website hltv.org. Check available methods on https://hltv-api.vercel.app/

Home Page: http://npm.im/hltv-api

License: MIT License

JavaScript 5.47% TypeScript 91.16% CSS 3.38%

hltv-api's Introduction

DEPRECATED

This repository is no longer maintained.

HLTV API

Build Status npm Codecov dependencies Status devDependencies Status

This is my experimental project, but also small useful module for node.js which helps you to easy implement data from popular CS:GO website hltv.org.

Installation

$ npm install hltv-api

Methods

  1. getNews
  2. getResults
  3. getMatches
  4. getMatchById
  5. getTopPlayers
  6. getPlayerById
  7. getTopTeams
  8. getTeamById

Check all the available methods and responses: https://hltv-api.vercel.app/

How to use

Simple API example

  • Using CommonJS module:
const HLTV = require('hltv-api').default
const express = require('express')
const app = express()

app.get('/', async (req, res) => {
  const news = await HLTV.getNews()
  res.json(news)
})

app.listen(3000, () => {
  console.log('Listening on port 3000...')
})
  • Using babel and necessary plugins (demo app)
import HLTV from 'hltv-api'

News

app.get('/', async (req, res) => {
  const news = await HLTV.getNews()
  res.json(news)
})
  • request
http://localhost:3000/
  • response

https://hltv-api.vercel.app/api/news.json

Results

app.get('/results', async (req, res) => {
  const results = await HLTV.getResults()
  res.json(results)
})
  • request
http://localhost:3000/results
  • response

https://hltv-api.vercel.app/api/results.json

Matches

app.get('/matches', async (req, res) => {
  const matches = await HLTV.getMatches()
  res.json(matches)
})
  • request
http://localhost:3000/matches
  • response

https://hltv-api.vercel.app/api/matches.json

Match Stats

app.get('/results/:matchId/stats', async (req, res) => {
  const stats = await HLTV.getMatchById(req.params.matchId)
  res.json(stats)
})
  • request
http://localhost:3000/stats/matches/2316387
  • response

https://hltv-api.vercel.app/api/match.json

Top Players

app.get('/players', async (req, res) => {
  const players = await HLTV.getTopPlayers()
  res.json(players)
})
  • request
http://localhost:3000/players
  • response

https://hltv-api.vercel.app/api/players.json

Player Stats

app.get('/players/:playerId', async (req, res) => {
  const player = await HLTV.getPlayerById(req.params.playerId)
  res.json(player)
})
  • request
http://localhost:3000/players/11893
  • response

https://hltv-api.vercel.app/api/player.json

Top Teams

app.get('/top-teams', async (req, res) => {
  const teams = await HLTV.getTopTeams()
  res.json(teams)
})
  • request
http://localhost:3000/top-teams
  • response

https://hltv-api.vercel.app/api/teams.json

Single Team

app.get('/teams/:teamId', async (req, res) => {
  const team = await HLTV.getTeamById(req.params.teamId)
  res.json(team)
})
  • request
http://localhost:3000/teams/11893
  • response

https://hltv-api.vercel.app/api/team.json

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.