Node.js API to retrieve top songs, albums, and artists from Billboard's charts
npm install billboard-top-100
const { getChart } = require('../billboard-top-100.js');
// date format YYYY-MM-DD
getChart('hot-100', '2016-08-27', (err, chart) => {
if (err) console.log(err);
console.log(chart.week) // prints the week of the chart in the date format YYYY-MM-DD
console.log(chart.previousWeek.url) // prints the URL of the previous week's chart
console.log(chart.previousWeek.date) // prints the date of the previous week's chart in the date format YYYY-MM-DD
console.log(chart.nextWeek.url) // prints the URL of the next week's chart
console.log(chart.nextWeek.date) // prints the date of the next week's chart in the date format YYYY-MM-DD
console.log(chart.songs); // prints array of top 100 songs for week of August 27, 2016
console.log(chart.songs[3]); // prints song with rank: 4 for week of August 27, 2016
console.log(chart.songs[0].title); // prints title of top song for week of August 27, 2016
console.log(chart.songs[0].artist); // prints artist of top songs for week of August 27, 2016
console.log(chart.songs[0].rank) // prints rank of top song (1) for week of August 27, 2016
console.log(chart.songs[0].cover) // prints URL for Billboard cover image of top song for week of August 27, 2016
});
// chartName defaults to hot-100
// date defaults to saturday of this week
getChart((err, chart) => {
if (err) console.log(err);
// use chart
});
// date defaults to saturday of this week
getChart('hot-100', (err, chart) => {
if (err) console.log(err);
// use chart
});
// 'All Time' chart
getChart('greatest-billboard-200-albums', (err, chart) => {
if (err) console.log(err);
console.log(chart.songs); //prints array of top 200 albums
console.log(chart.songs[3]); //prints album with rank: 4
console.log(chart.songs[0].title); //prints title of top album
console.log(chart.songs[0].artist); //prints artist of top songs
console.log(chart.songs[0].rank) //prints rank of top album (1)
console.log(chart.songs[0].cover) //prints URL for Billboard cover image of top album
});
// list all available charts
const { listCharts } = require('../billboard-top-100.js');
listCharts((err, charts) => {
if (err) console.log(err);
console.log(charts); // prints array of all charts
});
Type: function
Returns array of chartObjects separated by category
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.
Type: string
Name of chart.
Type: string
URL of chart.
Type: object
Chart containing songs, week, previousWeek, and nextWeek
Type: string
Chart week in date format YYYY-MM-DD
Type: object
Week object containing date and URL
Type: object
Week object containing date and URL
Type: array
Song objects.
Type: string
Chart week in date format YYYY-MM-DD
Type: string
Chart URL
Type: number
Rank of song on charts.
Type: string
Title of song.
Type: string
Name of artist of song.
Type: string
Cover image URL of song.
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.
MIT © Rishi Masand