npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

d2pt.js

v2.0.4

Published

Scraper Node.js para Dota 2 Pro Tracker — meta de heróis e informações por herói

Downloads

337

Readme

d2pt.js

📃 About

d2pt.js is a Node.js scraper for Dota 2 Pro Tracker, focused on hero meta and per-hero statistics.

Features

  • Hero meta — ranking by position (Carry, Mid, Offlane, Support)
  • Hero info — matches, win rate, and most-played role for a specific hero

Requirement: Node.js 18+


Installation

npm install d2pt.js
# or
yarn add d2pt.js
# or
pnpm add d2pt.js

Quick start

Create an instance and use the methods (all return a Promise):

const { D2PtScraper } = require("d2pt.js");
// ESM: import { D2PtScraper } from "d2pt.js";

const d2pt = new D2PtScraper();

getHeroInfo(heroName) — hero information

Returns hero stats by role (All Roles, Carry, Mid, Offlane, Support, Hard Support): matches, win rate, and which role is most played.

const heroInfo = await d2pt.getHeroInfo("Anti-Mage");
console.log(heroInfo);

Example response:

[
  {
    "role": "All Roles",
    "matches": "5339",
    "winRate": "49%",
    "mostPlayed": false
  },
  {
    "role": " Carry",
    "matches": "4948",
    "winRate": "49%",
    "mostPlayed": true
  },
  {
    "role": " Mid",
    "matches": "219",
    "winRate": "42%",
    "mostPlayed": false
  }
]
  • role — position (All Roles, Carry, Mid, Offlane, Support, Hard Support)
  • matches — number of matches (string)
  • winRate — win rate (e.g. "49%")
  • mostPlayedtrue for the most-played role

getHeroesMeta(category, max_result?) — meta heroes by position

Returns the list of meta heroes for a category.
Categories: "hc" (Carry), "mid", "off", "sup4", "sup5", "pos4", "pos5", "All", "Carry", "Mid", "Off".

// Top 3 carries in meta
const heroes = await d2pt.getHeroesMeta("hc", 3);
console.log(heroes);

Example response:

[
  {
    "name": "Clinkz",
    "rating": "3851",
    "matches": "5759",
    "winRate": "55.0%",
    "contestRate": "44.1%",
    "radiantWinRate": "58.2%",
    "direWinRate": "51.8%"
  },
  {
    "name": "Slark",
    "rating": "3398",
    "matches": "7717",
    "winRate": "52.1%",
    "contestRate": "46.0%",
    "radiantWinRate": "55.8%",
    "direWinRate": "48.2%"
  },
  {
    "name": "Drow Ranger",
    "rating": "3383",
    "matches": "4569",
    "winRate": "53.1%",
    "contestRate": "26.0%",
    "radiantWinRate": "56.8%",
    "direWinRate": "49.3%"
  }
]
  • name — hero name
  • rating — rating (string)
  • matches — matches (string)
  • winRate — win rate (e.g. "55.0%")
  • contestRate — contest rate (e.g. "44.1%")
  • radiantWinRate / direWinRate — win rate per side

max_result is optional; default is 10.


Full example (async/await)

const { D2PtScraper } = require("d2pt.js");

async function main() {
  const d2pt = new D2PtScraper();

  const heroInfo = await d2pt.getHeroInfo("Anti-Mage");
  console.log("Hero info:", heroInfo);

  const topCarries = await d2pt.getHeroesMeta("hc", 5);
  console.log("Top 5 carries:", topCarries);
}

main().catch(console.error);

With then/catch:

d2pt
  .getHeroesMeta("mid", 5)
  .then((result) => console.log(result))
  .catch((err) => console.error(err));

Development

git clone <repo>
cd d2pt.js
npm install

| Command | Description | |--------|-------------| | npm run build | Clean and compile (outputs to lib/) | | npm run example | Run example using built lib/ | | npm run example:hero | Hero-only example (ts-node) | | npm run example:meta | Meta-only example (ts-node) | | npm run test | Run tests (Jest) | | npm run watch | Build in watch mode |


💰 Support the project

BuyMeACoffee


👷‍♂️ Creator

Contributors

Twitter Twitch

Made with 💖 and JavaScript.

License

MIT

This project is not affiliated with Dota 2 Pro Tracker.