멜론 음원 서비스의 여러 데이터를 쉽게 스크래핑 할 수 있는 API 입니다.
-
멜론 웹 사이트의 다양한 종류의 데이터를 JSON으로 변환
- 멜론차트 TOP100
- 멜론 최신 음악
- 멜론 음악 검색
- 멜론 인기 키워드
-
비동기(async/await) 지원
-
내장 타입 선언(d.ts) 제공
npm install melona
interface ISongData {
songNo: number;
title: string;
artist: string;
album: string;
likeCnt: number;
}
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;
}
import { MelonChart } from 'melona';
const melonChart = new MelonChart();
const chart = await melonChart.getChart();
console.log(chart);
interface IChartData extends ISongData {
rank: number;
albumImg: string;
}
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;
}
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[];
}
MIT