NhacCuaTui API Library with Typescript support Support Nodejs server, client request (with proxy built in)
👉 nhaccuatui-api 👈
Respect a lot ❤️ 🙏
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
// .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();
})();
Get the data display on the homepage (Include song, artist, playlists, trending, ...)
getHome();
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");
Get the list of popular playlists
getPlaylists();
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");
Get the lyric in text and LRC file
getLyric("SONG_ID");
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");
Get popular topics
getTopics();
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");
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,
},
});
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");
Search songs, playlists, artists,... by keyword
searchByKeyword("SEARCH_KEYWORD");
Get top searched keywords
getTopKeyword();
Get top 10 artists
getTrendingArtists();
Parameters
- nation (Optional) - Default: "hot"
- gender (Optional) - Default: 1 (men)
// Default options
exploreArtists();
// Or With options
exploreArtists({
nation: "hot",
gender: 1,
});
Get one artist detail
Example Link: https://beta.nhaccuatui.com/nghe-si-erik.html
Then the ID is: erik
getArtistDetail("ARTIST_ID");
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,
});
🤩✨ If you enjoy using this library, give me a star on Github and share it to your friends. ✨🤩
✅ If you have an error caused by the api, maybe NhacCuaTui has updated. Try to update to the latest version, if not working, submit an Issue on the repository ✅