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

nct.js

v1.0.1

Published

A lightweight, zero-dependency Node.js client library for the NhacCuaTui (NCT) API, supporting search, stream extraction, lyrics parsing, and VIP user logins.

Downloads

250

Readme

A zero-dependency Node.js client library for the NhacCuaTui (NCT) API. It supports searching, fetching song streaming URLs, parsing lyrics, browsing topic categories, and handling user sessions/login.

Built with native fetch (requires Node.js 18+). Supports both CommonJS and ES Modules (TypeScript).

Tiếng Việt | English

Table of Contents


Installation

npm install nct.js

Quick Start

CommonJS (JavaScript)

const NhacCuaTui = require('nct.js');
const nct = new NhacCuaTui({ logLevel: 'info' });

async function run() {
  // Search for songs
  const searchResult = await nct.searchSongs('Chúng Ta Của Tương Lai', 1, 5);
  console.log(searchResult.songs);

  if (searchResult.songs.length > 0) {
    // Fetch streaming URLs and details
    const song = await nct.getSongDetail(searchResult.songs[0].key);
    console.log(song.streams);
  }
}
run();

ES Modules (TypeScript)

import NhacCuaTui, { Song } from 'nct.js';
const nct = new NhacCuaTui();

async function run() {
  const song: Song | null = await nct.getSongDetail('m0ooS1OfYFVi');
  console.log(song?.streams);
}
run();

Features

Client Configuration

Instantiate the client with optional configuration:

const nct = new NhacCuaTui({
  token: 'existing_jwt_token', // Optional session token
  logLevel: 'info' // 'debug' | 'info' | 'warn' | 'error' | 'none' (default: 'none')
});

Authentication & User Data

  • login(account, password): Logs in to an NCT account. Automatically hashes the password using MD5, performs the auth request, and sets the active session token.
  • getUserInfo(): Fetches profile data of the logged-in user.
  • getUserPlaylists(page = 0, size = 999): Retrieves user-created cloud playlists.
  • getUserFollowedPlaylists(page = 0, size = 999): Retrieves followed playlists.
  • getUserFollowedAlbums(page = 0, size = 999): Retrieves followed albums.

Browsing & Discovery

  • getHome(): Fetches homepage structure containing hot tracks, albums, playlists, and sections.
  • getTrendingList(): Fetches current hot charts (e.g. V-Pop, US-UK, K-Pop).
  • getTopicCategories(): Lists available browse categories (tabs).
  • getTopicCategoryDetails(categoryId, page = 1, size = 30): Lists playlist groups/items within a category.

Details & Recommendations

  • getSongDetail(songKey): Returns metadata, artist list, duration, and direct CDNs/streaming URLs.
  • getPlaylistDetail(playlistKey): Returns playlist/album metadata along with its track list.
  • getLyrics(songKey): Returns lyrics (either plain text or parsed timestamped LRC lines).
  • getSimilarSongs(songKey, page = 1, size = 20): Returns recommended similar tracks (useful for autoplay).

Search

  • searchAll(keyword): Executes a unified search across tracks, playlists, albums, artists, videos, and recommendations.
  • searchSongs(keyword, page = 1, size = 20)
  • searchPlaylists(keyword, page = 1, size = 20)
  • searchAlbums(keyword, page = 1, size = 20)
  • searchArtists(keyword, page = 1, size = 20)
  • searchVideos(keyword, page = 1, size = 20)
  • searchLyrics(keyword, page = 1, size = 20)
  • getSuggestions(prefix): Autocomplete suggestions as a user types.
  • getHotKeywords(): Returns trending keywords.

Notifications & Devices

  • initNotifications(): Initializes user notifications.
  • getNotifications(page = 1, size = 30): Lists push notifications.
  • saveFcmToken(fcmToken): Registers Firebase Cloud Messaging token.
  • checkAppUpgrade(): Verifies current application upgrade configurations.
  • getPopupConfigs(): Fetches popup configurations.
  • getActivityInfo(): Fetches active campaigns.

Development

Build

To compile the TypeScript source into both ES Modules and CommonJS outputs:

npm run build

Test

Run the integration test suite (targets live NCT APIs):

npm test

License

MIT