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

liapi

v1.0.34

Published

Automate routines that need cookie authorization.

Readme

liapi - a cookie based lichess API

Automate routines that need cookie authorization.

The module can be used in three ways, as a Node.js module, as a CLI or as a GUI.

Installation

As a Node.js module

Needs local installation:

npm install liapi

Usage:

let { login } = require('liapi')

login(username, password)

As a CLI

Needs global installation:

npm install liapi -g

Usage ( at the command prompt ):

liapicli login username password

As a GUI

Needs global installation:

npm install liapi -g

Usage ( at the command prompt ):

liapigui

This will open up a browser window, in which you can edit the state and issue commands.

API

login

Logs in the user, obtains the cookie and stores it in state.json.

Node.js

let { login } = require('liapi')

login(username, password)

CLI / GUI

login username password

jointourney

Joins a tourney.

Node.js

let { jointourney } = require('liapi')

jointourney(tourneyid, username, password, teamid, callbackopt)

Arguments password ( tourney password, not user password ! ), teamid ( for team battles only ) and callbackopt ( defines a callback upon success ) are optional ( depending on tourney type ), use null to ignore them. If callbackopt is a function it will be called after submitting the request.

CLI / GUI

jointourney tourneyid username[:password] teamid

Note that you can attach a tourney(!) password to the second argument with ":" for joining a password protected tourney. The teamid parameter should only be used for joining a team battle.

createtourney

Creates a tourney. Upon success the tourney create parameters are saved in state.json.

Tourneys are created from a username and a template. There is always a default template in state.json. You can copy it and add it to to state.templates under a new id. Edit the parameters, then you can use this id for creating a custom tournament.

For team battles the template should have a teamBattleByTeam field, containing the teamid of the team creating the team battle.

For team battles the template should also have a teams field. Its format is newline separated lines of text, each line describing a team in teamid "Team name" by teamleader format, as required in the second step of team battle creation. However it should be properly encoded as a JSON string with escapes for quotation marks and newlines.

{
  "templates": {
    "default": {
      "name": "Short Bullet Tourney",
      "clockTime": "2",
      "clockIncrement": "0",
      "minutes": "45",
      "waitMinutes": "5",
      "variant": "standard",
      "rated": "true",
      "position": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
      "password": "",
      "conditions.teamMember.teamId": "",
      "conditions.minRating.rating": "",
      "conditions.minRating.perf": "",
      "conditions.maxRating.rating": "",
      "conditions.maxRating.perf": "",
      "conditions.nbRatedGame.nb": "",
      "conditions.nbRatedGame.perf": "",
      "berserkable": "true",
      "startDate": "",
      "teamBattleByTeam": ""
    },
    "custom": {
      "name": "Short Blitz Tourney",
      "clockTime": "3",
      "clockIncrement": "0",
      "minutes": "45",
      "waitMinutes": "5",
      "variant": "standard",
      "rated": "true",
      "position": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
      "password": "",
      "conditions.teamMember.teamId": "",
      "conditions.minRating.rating": "",
      "conditions.minRating.perf": "",
      "conditions.maxRating.rating": "",
      "conditions.maxRating.perf": "",
      "conditions.nbRatedGame.nb": "",
      "conditions.nbRatedGame.perf": "",
      "berserkable": "true",
      "startDate": "",
      "teamBattleByTeam": ""
    }
  }
}

Node.js

let { createtourney } = require('liapi')

createtourney(username, template)

Template is either a full or partial template object. It itself can have a template id field template.template, which is a string that specifies which template to use from state.json as a basis ( if template.template is omitted, then the default template will be used as a basis.). Other fields in template argument modify this original template.

Examples:

createtourney("userfoo", {}) default template will be used

createtourney("userfoo", {template: "custom"}) "custom" template will be used

createtourney("userfoo", {template: "custom", waitMinutes: "10"}) "custom" template with waitMinutes modified to 10

In case of team battles you can use a wildcard * for username, in that case the username will be inferred to be the leader of the team creating the battle.

If startDate is next, the start date will be the start date of the last created tourney having a startDate property, plus 7 hours. If no such tourney was created, you get an error message.

Keep in mind that old tourneys are deleted from state.json upon startup.

CLI / GUI

createtourney username template

Here template is a template id in state.json. The whole template will be taken from state.json. The template parameter is optional, if not present the default template will be used. Note that the default template should not be edited. To edit a template you have to create a separate template under a custom id ( other than default ).

Editing and saving state.json

You can either edit the state with a text editor, or you can use the editor in the GUI, in which case to save it type:

save

at the GUI's command prompt. You will get a success message. If not, your JSON may very well be syntactically incorrect.

Using the GUI

Aliases

You can define an alias with:

a aliasname=command

then invoke the command with:

aliasname

To view aliases type:

a

To delete an alias type:

a aliasname=

You can always bring back the last issued command using the Up cursor key.