1.2.2 โข Published 5 months ago
melona v1.2.2
Melona๐ - ๋ฉ๋ก API ๋น๊ณต์ ๊ตฌํ
๋ฉ๋ก ์์ ์๋น์ค์ ์ฌ๋ฌ ๋ฐ์ดํฐ๋ฅผ ์ฝ๊ฒ ์คํฌ๋ํ ํ ์ ์๋ API ์ ๋๋ค.
Features
๋ฉ๋ก ์น ์ฌ์ดํธ์ ๋ค์ํ ์ข ๋ฅ์ ๋ฐ์ดํฐ๋ฅผ JSON์ผ๋ก ๋ณํ
- ๋ฉ๋ก ์ฐจํธ TOP100
- ๋ฉ๋ก ์ต์ ์์
- ๋ฉ๋ก ์์ ๊ฒ์
- ๋ฉ๋ก ์ธ๊ธฐ ํค์๋
๋น๋๊ธฐ(async/await) ์ง์
๋ด์ฅ ํ์ ์ ์ธ(d.ts) ์ ๊ณต
Install
npm install melona
Base Types
interface ISongData {
songNo: number;
title: string;
artist: string;
album: string;
likeCnt: number;
}
searchSong(params: ISearchParams) => Promise<ISearchSong[]>
import { MelonSearch } from 'melona';
const melonSearch = new MelonSearch();
const data = await melonSearch.searchSong({
query: '์คํ', // ์ค์ ๊ฒ์์ด๋ก ์นํํ์ธ์.
section: 'artist', // ์ฌ์ฉ ๊ฐ๋ฅํ ์ต์
: all, artist, song, album
});
console.log(data);
type SearchSection = 'all' | 'artist' | 'song' | 'album';
interface ISearchParams {
query: string;
section?: SearchSection;
}
interface ISearchSong extends ISongData {
num: number;
}
getChart() => Promise<IChartData[]>
import { MelonChart } from 'melona';
const melonChart = new MelonChart();
const chart = await melonChart.getChart();
console.log(chart);
interface IChartData extends ISongData {
rank: number;
albumImg: string;
}
getTable() => Promise<INewMusicData[]>
import { MelonNewMusic } from 'melona';
const melonNewMusic = new MelonNewMusic();
const table = await melonNewMusic.getTable();
console.log(table);
interface INewMusicData extends ISongData {
num: number;
songNo: number;
albumImg: string;
}
getKeywords() => Promise\
import { MelonKeywords } from 'melona';
const melonKeywords = new MelonKeywords();
const keywords = await melonKeywords.getKeywords();
console.log(keywords.trending); // ์ค์๊ฐ ๊ธ์์น ํค์๋
console.log(keywords.popular); // ์ธ๊ธฐ ํค์๋
interface IKeyword {
rank: number;
keyword: string;
rankChanges: string;
}
interface IKeywordChart {
trending: IKeyword[];
popular: IKeyword[];
}
License
MIT