melona
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Melona🍈 - 멜론 API 비공식 구현

License stars - melonchart forks - melonchart npm version Build Test

https://nodei.co/npm/melona.png?downloads=true&downloadRank=true&stars=true

og_image

멜론 음원 서비스의 여러 데이터를 쉽게 스크래핑 할 수 있는 API 입니다.

Features

Screenshot

  • 멜론 웹 사이트의 다양한 종류의 데이터를 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<IKeywordChart>

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

Package Sidebar

Install

npm i melona

Weekly Downloads

11

Version

1.2.2

License

MIT

Unpacked Size

46.6 kB

Total Files

43

Last publish

Collaborators

  • vientorepublic