npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

melon-chart-parser

v1.3.2

Published

Melon chart parser

Downloads

18

Readme

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

| Param | Type | Description | | --- | --- | --- | | option | Options | Information about the chart you will request. | | callback | getSongsCallback | The callback that handles the response. |

getSongsCallback : function

Callback for getting chart information.

Kind: global typedef

| Param | Type | Description | | --- | --- | --- | | res | Object | an array of songs. | | err | Object | error while requesting chart page. |

Options : Object

Request options.

Kind: global typedef
Properties

| Name | Type | Default | Description | | --- | --- | --- | --- | | limit | number | 50 | option.limit Limit how many songs you will get (default 50, max 100). | | type | string | "daily" | option.type The type of chart. (daily, week, year, genre) | | genre | string | "KPOP" | option.genre The type of genre. | | year | number | year of today | option.year Year. | | month | number | month of today | option.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)