1.3.2 • Published 2 years ago

melon-chart-parser v1.3.2

Weekly downloads
2
License
ISC
Repository
github
Last release
2 years ago

Melon Chart Parser

What's Melon Chart Parser?

Melon Chart Parser is a module that parses the melon chart and obtains the data of the songs.

Installation

npm install melon-chart-parser
yarn add melon-chart-parser

Examples

Get 10 songs from daily melon chart.

// var something = require('melon-chart-parser');
const melon = require('melon-chart-parser');

const opts = {
  limit: 10,
  type: 'daily'
};

// callback style
melon.parse(opts, function(res, err) {
  if (err) return;

  console.log(res);
});

// promise style
melon.parse(opts)
  .then(function(res) {
    console.log(res);
  })
  .catch(function(err) {
    console.log(err);
  });

Output should be like

[ { rank: 1,
    trackName: '남이 될 수 있을까',
    artistName: '볼빨간사춘기, 스무살',
    album: '남이 될 수 있을까' },
  { rank: 2,
    trackName: '무제(無題) (Untitled, 2014)',
    artistName: 'G-DRAGON',
    album: '권지용' },
  { rank: 3,
    trackName: '처음부터 너와 나',
    artistName: '볼빨간사춘기',
    album: '군주 - 가면의 주인 OST Part.2' },
  { rank: 4,
    trackName: 'Shape of You',
    artistName: 'Ed Sheeran',
    album: '÷ (Deluxe)' },
  { rank: 5,
    trackName: 'SIGNAL',
    artistName: 'TWICE (트와이스)',
    album: 'SIGNAL' },
  { rank: 6,
    trackName: '오늘 취하면 (Feat. 창모) (Prod. SUGA)',
    artistName: '수란 (SURAN)',
    album: 'WINE' },
  { rank: 7,
    trackName: 'New Face',
    artistName: '싸이 (PSY)',
    album: 'PSY 8th 4X2=8' },
  { rank: 8,
    trackName: 'NEVER',
    artistName: '국민의 아들',
    album: 'PRODUCE 101 - 35 Boys 5 Concepts' },
  { rank: 9,
    trackName: 'I LUV IT',
    artistName: '싸이 (PSY)',
    album: 'PSY 8th 4X2=8' },
  { rank: 10,
    trackName: '팔레트 (Feat. G-DRAGON)',
    artistName: '아이유',
    album: 'Palette' } ]

Get 50 songs of 2016-05's month chart.

const melon = require('melon-chart-parser');

const opts = {
  limit: 50,
  type: 'month',
  month: 5,
  year: 2016
};

melon.parse(opts, function(res, err) {
  if (err) return;

  console.log(res);
});

Get 100 songs of year chart.

const melon = require('melon-chart-parser');

const opts = {
  limit: 100,
  type: 'year',
  genre: 'KPOP', // or 'POP'
  year: 2015
};

melon.parse(opts, function(res, err) {
  if (err) return;

  console.log(res);
});

Get 100 songs of this week's chart by OST genre.

const melon = require('melon-chart-parser');

const opts = {
  limit: 100,
  type: 'genre',
  genre: 'DP0300', // A list of possible genres can be read at the bottom of the document.
};

melon.parse(opts, function(res, err) {
  if (err) return;

  console.log(res);
});

Get 50 songs of IU songs, which is ordered by popularity.

const melon = require('melon-chart-parser');

const opts = {
  limit: 50,
  type: 'artist',
  term: '아이유'
};

melon.parse(opts, function(res, err) {
  if (err) return;

  console.log(res);
});

Functions

Typedefs

parse(option, callback)

Parse melon chart.

Kind: global function

ParamTypeDescription
optionOptionsInformation about the chart you will request.
callbackgetSongsCallbackThe callback that handles the response.

getSongsCallback : function

Callback for getting chart information.

Kind: global typedef

ParamTypeDescription
resObjectan array of songs.
errObjecterror while requesting chart page.

Options : Object

Request options.

Kind: global typedef
Properties

NameTypeDefaultDescription
limitnumber50option.limit Limit how many songs you will get (default 50, max 100).
typestring"daily"option.type The type of chart. (daily, week, year, genre)
genrestring"KPOP"option.genre The type of genre.
yearnumberyear of todayoption.year Year.
monthnumbermonth of todayoption.month Month.

Genre list

when type is 'genre' you can send genre by genre parameter below value.

'DM0000' 국내종합,
'AB0000' 해외종합,
'GN0100' 발라드,
'GN0200' 댄스,
'GN0300' 랩/힙합,
'GN0400' R&B/Soul,
'GN0500' 인디음악,
'GN0600' 록/메탈,
'GN0700' 트로트,
'GN0800' 포크/블루스,
'GN0900' (해외) POP,
'GN1000' (해외) 록/메탈,
'GN1100' (해외) 일렉트로니카,
'GN1200' (해외) 랩/힙합,
'GN1300' (해외) R&B/Soul,
'GN1400' (해외) 포크/블루스/컨트리,
'GN1500' OST,
'GN1700' 재즈,
'GN1800' 뉴에이지,
'GN1900' J-POP,
'GN2000' 월드뮤직,
'GN2100' CCM,
'GN2200' 어린이/태교,
'GN2300' 종교음악,
'GN2400' 국악

or if type is 'year' you can send genre parameter below value.

'KPOP' (KPOP),
'POP' (POP)
1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

6 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago