Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bb-top-100

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bb-top-100

Gets the top songs, albums, and artists from Billboard's charts

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by1100%
Maintainers
1
Weekly downloads
 
Created
Source


Node.js API to retrieve top songs, albums, and artists from Billboard's charts

Build Status codecov Codacy Badge contributions welcome

install

npm install billboard-top-100

example

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
});

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

Keywords

FAQs

Package last updated on 30 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc