Skip to content

alexklann/wkbp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WKBP

A simple CLI tool to get the remaining WaniKani and Bunpro reviews.

Overview

WKBP fetches your pending review counts from both WaniKani and Bunpro and displays them in your terminal.

WaniKani  │ 42 Reviews Ready
Bunpro    │ 17 Grammar · 8 Vocab

Both services are queried concurrently so the result is near-instant.

Installation

Prerequisites

Build from source

git clone https://codeberg.org/klann/wkbp.git
cd wkbp
cargo build --release

The binary will be at ./target/release/wkbp.

Configuration

On first run, WKBP will create a config file at ~/.config/wkbp/config.toml and exit:

Config created at ~/.config/wkbp/config.toml — please fill it in.

Open the file and fill in your credentials:

wanikani_api_key = "your-wanikani-api-key"
bunpro_email = "your-bunpro-email"
bunpro_password = "your-bunpro-password"

WaniKani API key — generate one at wanikani.com/settings/personal_access_tokens. Read-only permissions are sufficient.

Bunpro credentials — your regular login email and password. WKBP logs in on your behalf to obtain a session token, which is used for all subsequent requests.

Note: Bunpro does not currently offer a stable public API. WKBP authenticates via the same frontend API their web app uses. This means it may break if Bunpro changes their login flow.

Usage

wkbp

That's it. Run it whenever you want a quick summary of your pending reviews.

How it works

WaniKani has a well-documented public API. WKBP calls the /v2/assignments endpoint with your API key to get the count of items immediately available for review.

Bunpro does not have a stable public API. WKBP works around this by:

  1. Fetching the Bunpro login page and scraping the Rails CSRF token
  2. Submitting your credentials via a form POST to obtain a session
  3. Extracting the frontend_api_token cookie from the response
  4. Using that token to call Bunpro's internal frontend API

The two review fetches run concurrently via tokio::try_join! so there's no added latency from querying two services.

Caveats

  • Bunpro session token — the frontend_api_token expires after 6 hours. WKBP re-authenticates automatically for you, so this is handled transparently.
  • Credentials at rest — your Bunpro password is stored in plaintext in ~/.config/wkbp/config.toml.

License

This project uses a GPL-3.0-or-later license. For more information see LICENSE.

About

A simple CLI tool to get the remaining WaniKani and Bunpro reviews.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors