
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
hltb-client
Advanced tools
A TypeScript client for the HowLongToBeat API. Get game completion times programmatically.
A TypeScript client for the HowLongToBeat API. Get game completion times programmatically.
npm install hltb-client
import { HLTBClient } from 'hltb-client';
const client = new HLTBClient();
// Search for games
const games = await client.search('Elden Ring');
console.log(games[0]);
// {
// id: '68151',
// name: 'Elden Ring',
// imageUrl: 'https://howlongtobeat.com/games/68151_Elden_Ring.jpg',
// completionTimes: { main: 60, mainExtra: 101, completionist: 136, allStyles: 98 },
// platforms: 'PC, PlayStation 4, PlayStation 5, Xbox One, Xbox Series X/S',
// releaseYear: 2022,
// reviewScore: 92
// }
// Get a single game
const game = await client.searchOne('The Witcher 3');
// Get just completion times
const times = await client.getCompletionTimes('Zelda Breath of the Wild');
console.log(times);
// { main: 50, mainExtra: 98, completionist: 189, allStyles: 97 }
const { HLTBClient } = require('hltb-client');
const client = new HLTBClient();
const games = await client.search('Dark Souls');
new HLTBClient(options?)Creates a new HLTB client instance.
| Option | Type | Default | Description |
|---|---|---|---|
userAgent | string | Chrome UA | Custom user agent string |
tokenCacheDuration | number | 3600000 | Token cache duration in ms (1 hour) |
client.search(query, options?)Search for games by name.
Parameters:
query (string) - Search queryoptions (object, optional)
limit (number) - Max results to return (default: 20)platform (string) - Filter by platformsortBy (string) - Sort by: 'popular', 'name', 'rating', 'length', 'release'Returns: Promise<HLTBGame[]>
const games = await client.search('Mario', { limit: 5, sortBy: 'popular' });
client.searchOne(name)Search for a single game by name. Returns the best match.
Parameters:
name (string) - Game name to search forReturns: Promise<HLTBGame | null>
const game = await client.searchOne('Hollow Knight');
if (game) {
console.log(`${game.name}: ${game.completionTimes.main} hours`);
}
client.getCompletionTimes(name)Get completion times for a game. Convenience method that returns just the times.
Parameters:
name (string) - Game name to search forReturns: Promise<HLTBCompletionTimes>
const times = await client.getCompletionTimes('Celeste');
console.log(`Main story: ${times.main} hours`);
console.log(`Completionist: ${times.completionist} hours`);
HLTBGameinterface HLTBGame {
id: string; // HowLongToBeat game ID
name: string; // Game name
imageUrl?: string; // Cover image URL
completionTimes: HLTBCompletionTimes; // Completion times in hours
platforms?: string; // Available platforms
releaseYear?: number; // Release year
reviewScore?: number; // User score (0-100)
}
HLTBCompletionTimesinterface HLTBCompletionTimes {
main?: number; // Main story (hours)
mainExtra?: number; // Main + extras (hours)
completionist?: number; // 100% completion (hours)
allStyles?: number; // Average of all playstyles (hours)
}
HLTBSearchOptionsinterface HLTBSearchOptions {
limit?: number; // Results to return (default: 20)
platform?: string; // Platform filter
sortBy?: 'popular' | 'name' | 'rating' | 'length' | 'release';
}
The client throws errors for network issues or authentication failures:
try {
const games = await client.search('Some Game');
} catch (error) {
if (error.message.includes('authentication')) {
console.error('Failed to authenticate with HLTB');
} else {
console.error('Network error:', error.message);
}
}
This client interfaces with HowLongToBeat's internal API:
/api/search/init/api/searchHowLongToBeat doesn't publish rate limits. This client:
This is an unofficial client. HowLongToBeat doesn't provide a public API, so this library may break if they change their internal API. Use responsibly.
MIT
FAQs
A TypeScript client for the HowLongToBeat API. Get game completion times programmatically.
The npm package hltb-client receives a total of 4 weekly downloads. As such, hltb-client popularity was classified as not popular.
We found that hltb-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.