Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gabrielcstr/d2pt.js
📦 A Minimalistic Node.js DOTA PRO TRACKER SCRAPER
https://github.com/gabrielcstr/d2pt.js
Last synced: 3 months ago
JSON representation
📦 A Minimalistic Node.js DOTA PRO TRACKER SCRAPER
- Host: GitHub
- URL: https://github.com/gabrielcstr/d2pt.js
- Owner: GabrielCSTR
- License: mit
- Created: 2024-06-23T01:12:10.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2024-11-09T14:43:49.000Z (3 months ago)
- Last Synced: 2024-11-09T15:17:34.727Z (3 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/d2pt.js
- Size: 169 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# d2pt.js
## 📃 About
![]()
📦 A Minimalistic Node.js DOTA PRO TRACKER SCRAPER- [x] Get all meta heroes
- [x] Get specific hero### Features
- Scraping specific information from [DOTA2 PRO TRACKER](https://dota2protracker.com/hero)
- Meta hero
- Hero info## Installation
**Node.js 18 or newer is required.**
Install it locally in your project folder:
```bash
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:
```javascript
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:
```javascript
// 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`).
```bash
# 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:
```bash
# for compilation
npm run build
```## 💰 Support
Not required but if you want... then by all means gib me ur cash please 💰 🔫
[](https://buymeacoffee.com/gabriel.dev/)
## 👷♂️ Creator
[](https://github.com/GabrielCSTR)
[](https://twitter.com/gbrl_str) [](https://twitch.tv/xstrdoto)
Made with 💖 and JavaScript!
## License
[MIT](https://github.com/GabrielCSTR/d2pt.js/blob/master/LICENSE)
_This project is not affiliated with [DOTA2 PRO TRACKER](https://dota2protracker.com/meta) in any way._