1.0.9 • Published 7 months ago

d2pt.js v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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',
//   contestRate: '0.5962534336020174',
//   rating: '3570',
//   radiantWinRate: '0.544',
//   direWinRate: '0.53',
// },
//...

// 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.

1.0.9

7 months ago

1.0.8

9 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago