Node.js API to retrieve top songs, albums, and artists from Billboard's charts
install
npm install billboard-top-100
example
const { getChart } = require('../billboard-top-100.js');
getChart('hot-100', '2016-08-27', (err, chart) => {
if (err) console.log(err);
console.log(chart.week)
console.log(chart.previousWeek.url)
console.log(chart.previousWeek.date)
console.log(chart.nextWeek.url)
console.log(chart.nextWeek.date)
console.log(chart.songs);
console.log(chart.songs[3]);
console.log(chart.songs[0].title);
console.log(chart.songs[0].artist);
console.log(chart.songs[0].rank)
console.log(chart.songs[0].cover)
});
getChart((err, chart) => {
if (err) console.log(err);
});
getChart('hot-100', (err, chart) => {
if (err) console.log(err);
});
getChart('greatest-billboard-200-albums', (err, chart) => {
if (err) console.log(err);
console.log(chart.songs);
console.log(chart.songs[3]);
console.log(chart.songs[0].title);
console.log(chart.songs[0].artist);
console.log(chart.songs[0].rank)
console.log(chart.songs[0].cover)
});
const { listCharts } = require('../billboard-top-100.js');
listCharts((err, charts) => {
if (err) console.log(err);
console.log(charts);
});
api
listCharts(callback)
Type: function
Returns array of chartObjects separated by category
getChart([chartName][,date], callback)
Type: function
chartName
string
date
string ('all time' charts will not accept a date)
callback
function
Returns array of songs/albums/artists (as specified by chart) in chart.
chartObject.name
Type: string
Name of chart.
chartObject.url
Type: string
URL of chart.
chart
Type: object
Chart containing songs, week, previousWeek, and nextWeek
chart.week
Type: string
Chart week in date format YYYY-MM-DD
chart.previousWeek
Type: object
Week object containing date and URL
chart.nextWeek
Type: object
Week object containing date and URL
chart.songs
Type: array
Song objects.
weekObject.date
Type: string
Chart week in date format YYYY-MM-DD
weekObject.url
Type: string
Chart URL
songObject.rank
Type: number
Rank of song on charts.
songObject.title
Type: string
Title of song.
songObject.artist
Type: string
Name of artist of song.
songObject.cover
Type: string
Cover image URL of song.
songObject.position
Type: object
Last Week
string (position of song on chart last week)
Peak Position
string (peak position of song on chart)
Wks on Chart
string (number of weeks song has been on chart)
Position information of song.
license
MIT © Rishi Masand