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 🙏

© 2024 – Pkg Stats / Ryan Hefner

krosmap

v1.0.3

Published

Krosmaga data wrapper

Downloads

12

Readme

Krosmap

Krosmaga website parser

install

npm i krosmap --save

usage

const krosmap = require('krosmap')

const json = await krosmap.fetchUser('OTK-Val')

console.log(json) // Data may be missing

stable methods

fetchUser( username )                       // fetch all data of user

fetchUserGlobal( username )                 // fetch global position
fetchUserSeason( username, season="last" )  // fetch season position

fetchGlobal()                               // fetch global top 100
fetchSeason( season="last" )                // fetch season top 100

fetchUserProfile( username )                // fetch profile only

other properties

krosmap.images.global //=> https://static.ankama.com/krosmaga/www/modules/community/ladder/header_eternal.fr.jpg
krosmap.images.season //=> https://static.ankama.com/krosmaga/www/modules/community/ladder/header_season.fr.jpg

fetchUser( string: username ): Promise( Object )

When you fetch a user with fetchUser method, you get a JSON object containing information on their Ankama profile as well as their position in the global ranking and their position in the seasonal ranking of the last season. The fetchUser method simply calls three other Krosmap methods: fetchUserProfile, fethUserGlobal and fetchUserSeason.

return {
  profile: {
    username: 'OTK-Val',
    avatar: 'https://static.ankama.com/web-test/0.png',
    description: "\nOTK-Val n'a pas encore rédigé de description personnalisée"
  },
  global: { position: 722, win: 1558, lose: 1167, elo: 1553 },
  lastSeason: { position: 3409, win: 3, lose: 1, rank: 9 }
}

Krosmap being a data parser tool from Krosmaga website, there is a non-zero chance that some of its data will not reach you. So consider testing each direct property of the JSON data.

return {
  profile: false, // usually due to error 429 (try again later)
  global: false, // just because of bugs in the web page
  lastSeason: false // the same as for "global" property
}

fetchGlobal( ): Promise( Array )

The fetchGlobal method provides the top 100 of the global ranking.

// example data are fake kappa
return [
  { position: 1, win: 100, lose: 1, elo: 1950, username: 'Ghom' },
  { position: 2, win: 100, lose: 5, elo: 1800, username: 'OTK-Val' },
  { position: 3, win: 200, lose: 120, elo: 1400, username: 'ASK-ing' },
  { position: 4, win: 100, lose: 60, elo: 1310, username: 'BOSS-RNG' },
  {...}
  { position: 100, win: 50, lose: 50, elo: 900, username: 'Nono42' },
]

fetchSeason( number|string: ?season = 'last' ): Promise( Array )

The fetchSeason method provides the top 100 of the last season ranking or of the given season.

return [
  { position: 1, win: 100, lose: 1, rank: 30, username: 'Ghom' },
  { position: 2, win: 100, lose: 5, rank: 30, username: 'OTK-Val' },
  { position: 3, win: 200, lose: 120, rank: 30, username: 'ASK-ing' },
  { position: 4, win: 100, lose: 60, rank: 30, username: 'BOSS-RNG' },
  {...}
  { position: 100, win: 50, lose: 50, rank: 29, username: 'Nono42' },
]