NhacCuaTui API Full
NhacCuaTui API Library with Typescript support Support Nodejs server, client request (with proxy built in)
Original Library
Respect a lot
Installation
npm i nhaccuatui-api-full
Common JS
const NhacCuaTui = require("nhaccuatui-api-full");
// or
const {
getHome,
getSong,
getPlaylists,
//... and many other services
} = require("nhaccuatui-api-full");
ES Import
import NhacCuaTui from "nhaccuatui-api-full";
// or
import {
getHome,
getSong,
getPlaylists,
//... and many other services
} from "nhaccuatui-api-full";
To use this library with Vite remember to add this plugin @originjs/vite-plugin-commonjs
Usage
Get Data
// .then
getHome().then((data) => console.log(data));
// or
NhacCuaTui.getHome().then((data) => console.log(data));
// async - await
(async () => {
const data = await getHome();
// or
const data = await NhacCuaTui.getHome();
})();
1. Get Home
Get the data display on the homepage (Include song, artist, playlists, trending, ...)
getHome();
2. Get Song
Get the song detail
Example Link: https://beta.nhaccuatui.com/bai-hat/buoc-qua-nhau-vu.EdENCgJm9dAa.html
Then the ID is: EdENCgJm9dAa
getSong("SONG_ID");
3. Get Playlists
Get the list of popular playlists
getPlaylists();
4. Get Playlist Detail
Get the playlist detail
Example Link: https://beta.nhaccuatui.com/playlist/nhac-viet-hot-thang-12-va.7ROXQyroRFYT.html
Then the ID is: 7ROXQyroRFYT
getPlaylistDetail("PLAYLIST_ID");
5. Get Lyric
Get the lyric in text and LRC file
getLyric("SONG_ID");
6. Get Video / MV Detail
Get Music Video detail
Example Link: https://beta.nhaccuatui.com/video/co-hen-voi-thanh-xuan-monstar.IXTbg1bBelQKh.html
Then the ID is: IXTbg1bBelQKh
getVideoDetail("VIDEO_ID");
7. Get Topics
Get popular topics
getTopics();
8. Get Topic Detail
Get the topic detail
Example Link: https://beta.nhaccuatui.com/chu-de/hot-v-pop.weiwjycnu.html
Then the ID is: weiwjycnu
getTopicDetail("TOPIC_ID");
9. Get Chart
Get Top Songs
Parameters
- Category (Optional). Default: "nhac-viet"
- Time (Optional)
- Week: number
- Year: number
// Use default option
getChart();
// or custom property
getChart({
category: "nhac-viet",
time: {
week: 48,
year: 2021,
},
});
10. Get Top 100
Get the top 100 song of the playlist
Example Link: https://beta.nhaccuatui.com/top100/top-100-nhac-tre.m3liaiy6vVsF.html So the ID is: m3liaiy6vVsF
getTop100("TOP_100_ID");
11. Search by Keyword
Search songs, playlists, artists,... by keyword
searchByKeyword("SEARCH_KEYWORD");
12. Get Top Keywords
Get top searched keywords
getTopKeyword();
13. Get trending artists
Get top 10 artists
getTrendingArtists();
14. Explore artists
Parameters
- nation (Optional) - Default: "hot"
- gender (Optional) - Default: 1 (men)
// Default options
exploreArtists();
// Or With options
exploreArtists({
nation: "hot",
gender: 1,
});
15. Get artist Detail
Get one artist detail
Example Link: https://beta.nhaccuatui.com/nghe-si-erik.html
Then the ID is: erik
getArtistDetail("ARTIST_ID");
16. Explore (Song, Playlist, MV)
Parameters
- type (Required) - "song" || "playlist" || "mv"
- key (Optional) - Default: "moi-hot"
- page (Optional) - Default: 1
- pageSize (Optional) - Default: 36
// Default options
explore({
type: "song", // or "playlist" or "mv"
});
// With more options
explore({
type: "song",
key: "moi-hot",
page: 1,
pageSize: 36,
});