Giter Site home page Giter Site logo

d2pt.js's Introduction

d2pt.js

๐Ÿ“ƒ About

๐Ÿ“ฆ A Minimalistic Node.js DOTA PRO TRACKER SCRAPER

  • Get all meta heroes
  • Get specific hero

Features

Installation

Node.js 18 or newer is required.

Install it locally in your project folder:

npm install d2pt.js
# Or Yarn
yarn add d2pt.js
# Or pnpm
pnpm add d2pt.js

Example

Firstly, create an instance of the main class:

const { D2PtScraper } = require("d2pt.js");
// this library supports both CJS and ESM modules:
// import { D2PtScraper } from 'd2pt.js';

const d2pt = new D2PtScraper();

All methods will return a promise. Be sure to handle them accordingly, for example:

// Use "then" syntax
d2pt
 .getHeroesMeta("MID")
 .then((result) => {
  console.log(result);
 })
 .catch((error) => {
  console.error("Error:", error);
 });

// Use acync/await syntax
async function getMetaheroes() {
 const result = await d2pt.getHeroesMeta("MID");
 console.log(result);
}

// Will return:
// {
//   role: 'pos 1',
//   name: 'Templar Assassin',
//   matches: '2829',
//   winRate: '0.537',
//   winRate9500: '0.535',
//   contestRate: '0.5962534336020174',
//   rating: '3570',
//   radiantWinRate: '0.544',
//   direWinRate: '0.53',
//   expertWinRate: '0.588',
//   phase1WinRate: '0.497',
//   phase2WinRate: '0.531',
//   phase3WinRate: '0.583',
//   networth: '4668'
// },
//...

// Handling queryParameters
d2pt
 .getMetaheroes("MID", { max_result: 10 }) // in a form of an object
 .then((result) => {
  console.log(result);
 })
 .catch((err) => {
  console.log(err);
 });

Development

First of all, clone the repository and install dev-dependencies with npm install (or pnpm install or yarn install).

# launch tests
npm run test

Building

You can create a production version of the library with the following command.

In case if you want only to either compile or make the documentation file:

# for compilation
npm run build

๐Ÿ’ฐ Support

Not required but if you want... then by all means gib me ur cash please ๐Ÿ’ฐ ๐Ÿ”ซ

BuyMeACoffee

๐Ÿ‘ทโ€โ™‚๏ธ Creator

Contributors

Twitter Twitch

Made with ๐Ÿ’– and JavaScript!

License

MIT

This project is not affiliated with DOTA2 PRO TRACKER in any way.

d2pt.js's People

Contributors

gabrielcstr avatar

Stargazers

 avatar

Watchers

 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.