Hiroba.js
A donder hiroba scraping library for javascript
Install / Use
/learn @hotsixman/Hiroba.jsREADME
hiroba-js
[!NOTE] This document was written by Gemini and may contain errors.
hiroba-js is a TypeScript library for scraping data from the website donderhiroba.jp. It aims to provide programmatic access to player data by making HTTP requests and parsing the resulting HTML.
Installation
npm install hiroba-js
DonderHiroba Class
The DonderHiroba class is the core of the library, managing interactions with donderhiroba.jp. An instance of this class represents a logged-in user's session and provides various methods for fetching and managing their data.
DonderHiroba Instance
A DonderHiroba instance holds the state of a logged-in user, including their session token and cached data. It provides methods to interact with the website on behalf of the user.
Properties
-
token?: string: The session token for the logged-in user. This token is required to make authenticated requests to the website. -
namcoLogined: boolean: A boolean value that indicates whether the user is logged into their Namco ID. This is set totrueafter a successful login. -
cardLogined: boolean: A boolean value that indicates whether the user is logged into a specific Taiko card. This is set totrueafter a successful card login. -
currentLogin: (CardData & {summary?: Summary}) | null: An object containing the data of the currently logged-in card. It isnullif no card is logged in. -
cardList: CardData[]: An array ofCardDataobjects, representing the user's Taiko cards. -
clearData: Map<string, ClearData>: AMapobject that stores the clear data for each song. The key is the song number (string), and the value is aClearDataobject. -
scoreData: Map<string, ScoreData>: AMapobject that stores the score data for each song. The key is the song number (string), and the value is aScoreDataobject. -
ticket: string | null: A string value that is required for certain actions, such as changing the nickname. It isnullif no ticket has been fetched. -
recentPlayed: RecentPlayed[]: An array ofRecentPlayedobjects, representing the user's recently played songs.
Methods
-
constructor(token?: string): Creates a newDonderHirobainstance.token(string, optional): A session token can be provided to initialize the instance with a specific login session.
-
checkNamcoLogined(): Promise<boolean>: Checks if the user is logged into their Namco ID. This will log the user out of their card.- Returns: A
Promisethat resolves withtrueif the user is logged in, andfalseotherwise.
- Returns: A
-
checkCardLogined(): Promise<boolean>: Checks if the user is logged into a specific Taiko card. This may log the user out of their Namco ID.- Returns: A
Promisethat resolves withtrueif the user is logged in, andfalseotherwise.
- Returns: A
-
reloadCardList(): Promise<void>: Reloads the list of the user's Taiko cards. -
cardLogin(taikoNumber: string): Promise<void>: Logs into a specific Taiko card.taikoNumber(string): The Taiko number of the card to log in with.
-
updateClearData(genre?: keyof typeof Const.genre): Promise<Record<string, ClearData>>: Updates the clear data for a specific genre and returns the updated data.genre(keyof typeof Const.genre, optional): The genre to update the clear data for. If not provided, all genres will be updated.- Returns: A
Promisethat resolves with aRecordobject containing the updated clear data, with the song number as the key.
-
updateScoreData(songNo: string, difficulty?: Difficulty): Promise<ScoreData | null>: Updates the score data for a specific song and difficulty and returns the updated data.songNo(string): The song number to update the score data for.difficulty(Difficulty, optional): The difficulty to update the score data for. If not provided, all difficulties will be updated.- Returns: A
Promisethat resolves with the updatedScoreDataobject, ornullif the song was not found.
-
updateRecord(): Promise<void>: Refreshes the song score data. -
changeName(newName: string): Promise<CardData | null>: Changes the user's nickname.newName(string): The new nickname.- Returns: A
Promisethat resolves with the updatedCardDataobject, ornullif the nickname change failed.
-
getTicket(): Promise<string | null>: Fetches a ticket value required for certain actions.- Returns: A
Promisethat resolves with the ticket value, ornullif the ticket could not be fetched.
- Returns: A
Static Properties & Methods
The DonderHiroba class provides several static namespaces and methods that can be called directly without creating an instance. These static members are primarily used for fetching HTML from specific pages (request), parsing that HTML (parse), or combining multiple requests and parsing steps to perform a specific function (func).
DonderHiroba.login(options)
This static method of the DonderHiroba class logs into donderhiroba.jp using an email and password, creates a DonderHiroba instance, and returns it. If a taikoNumber is provided, it will also perform a card login for that Taiko number.
- Arguments:
options(object):email(string): The email address registered ondonderhiroba.jp.password(string): The password registered ondonderhiroba.jp.taikoNumber(string, optional): The Taiko number to log in with.
- Returns:
Promise<DonderHiroba>: APromisethat resolves with a logged-in instance of theDonderHirobaclass.
DonderHiroba.func
The DonderHiroba.func namespace is an object containing high-level functions that combine functions from request and parse to perform specific tasks. For example, the getCardList function fetches the HTML with request.cardList and then parses it with parse.cardList to return the final result.
- Key Methods:
getSessionToken(credentials: { email: string, password: string }): Promise<string>: Logs in with an email and password to get a session token.getCardList(data?: { token?: string }): Promise<CardData[]>: Fetches the list of cards registered to the account.cardLogin(data: { token?: string, taikoNumber: string, cardList?: CardData[] }): Promise<CardData>: Logs in with a specific Taiko number.getClearData(data?: { token?: string, genre?: keyof typeof Const.genre }): Promise<ClearData[]>: Fetches the clear data.getScoreData(data: { token?: string, songNo: string, difficulty?: Difficulty }): Promise<ScoreData | null>: Fetches the score data for a song.getDaniData(data?: { token?: string, daniNo?: number }): Promise<DaniData | DaniData[] | null>: Fetches the Dan-i Dojo play data.getCompeDetail(data: { token?: string, compeId: string }): Promise<CompeDetail | null>: Fetches the details of a competition.getCompeRanking(data: { token?: string, compeId: string }): Promise<RankingData[] | null>: Fetches the ranking data for a competition.getCompeData(data: { token?: string, compeId: string }): Promise<CompeData | null>: Fetches both the details and ranking data for a competition.getCurrentLogin(data?: { token?: string }): Promise<(CardData & {summary?: Summary}) | null>: Fetches the data of the currently logged-in card.updateRecord(data: { token?: string }): Promise<void>: Refreshes the song score data.changeName(data: { token?: string, ticket: string, newName: string }): Promise<void>: Changes the nickname.getTicket(data?: { token?: string }): Promise<string | null>: Fetches theticketvalue required for changing the nickname.getRecentPlayed(data?: { token?: string }): Promise<RecentPlayed[]>: Fetches the recently played songs.getDaniPass(data: { token?: string, dan?: DaniNo }): Promise<DaniPassData | Record<DaniNo, DaniPassData>>: Fetches and parses the Dan-i Pass images.data(object):token(string, optional): The session token.dan(DaniNo, optional): The specific Dan-i number to fetch. If omitted, all available Dan-i Passes will be fetched. (1 is 5kyu, and 19 is tatsujin)
- Returns: A
Promisethat resolves withDaniPassDataif a specificdanis provided, or aRecord<DaniNo, DaniPassData>ifdanis omitted.
DonderHiroba.request
The DonderHiroba.request namespace is an object containing functions that send HTTP requests to specific pages on donderhiroba.jp and return the resulting HTML string. Most of these functions accept a token argument to maintain the login state.
- Key Methods:
cardList(data?: { token?: string }): Promise<string>: Fetches the HTML of the card selection page.clearData(data?: { token?: string, genre?: keyof typeof Const.genre }): Promise<string | string[]>: Fetches the HTML of the clear data page.scoreData(data: { token?: string, songNo: string, difficulty?: Difficulty }): Promise<string | string[]>: Fetches the HTML of the score data page.daniData(data?: { token?: string, daniNo?: number }): Promise<string | string[]>: Fetches the HTML of the Dan-i Dojo data page.compeDetail(data: { token?: string, compeId: string }): Promise<string>: Fetches the HTML of the competition details page.compeRanking(data: { token?: string, compeId: string }): Promise<string>: Fetches the HTML of the competition ranking page.currentLogin(data?: { token?: string }): Promise<string>: Fetches the HTML of the main page to get the currently logged-in card information.daniPlate(data: { token?: string, dan?: DaniNo }): Promise<Blob | Blob[]>: Fetches the Dan-i Pa
Related Skills
node-connect
350.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
350.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
350.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
