Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@aribradshaw/billboard-top-100

aribradshaw40MIT3.0.4

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

billboard, charts, songs, music, api, scraper, hot-100, music-charts, billboard-charts

readme

# Billboard Top 100

A modern Node.js library for fetching Billboard chart data. This is a fork of the original billboard-top-100 library, updated to use modern dependencies and ES modules.

Version 3.0.4 - Latest Release

This version includes significant improvements:

  • Node.js 18+ Support: Updated to require Node.js 18+ for better performance and modern features
  • Fixed ReadableStream Issue: Resolved the ReadableStream is not defined error that was breaking CI/CD
  • Updated Dependencies: All dependencies updated to latest stable versions
  • Improved Test Reliability: Fixed timeout issues and improved test stability
  • Better CI/CD: Updated GitHub Actions to test against Node.js 18 and 20
  • Stable CI/CD Pipeline: All workflows now properly configured for Node.js 18+
  • npm Token Configured: Repository secrets updated for automatic publishing
  • No Deprecated Dependencies: Removed all deprecated packages (node-fetch, har-validator, etc.)
  • Native Fetch: Uses Node.js 18+ native fetch for better performance

Features

  • Modern Dependencies: Uses node-fetch instead of deprecated request package
  • ES Modules: Full ES module support with import/export
  • Security Updates: Updated all dependencies to latest secure versions
  • No Deprecation Warnings: All deprecated packages have been replaced
  • TypeScript Ready: Can be easily used in TypeScript projects

Installation

npm install @aribradshaw/billboard-top-100

Usage

import { getChart, listCharts } from '@aribradshaw/billboard-top-100';

// Get current Hot 100 chart
getChart('hot-100', (err, chart) => {
  if (err) {
    console.error('Error:', err);
    return;
  }

  console.log('Week of:', chart.week);
  console.log('Number 1 song:', chart.songs[0]);
});

// Get a specific week's chart
getChart('hot-100', '2023-12-30', (err, chart) => {
  if (err) {
    console.error('Error:', err);
    return;
  }

  console.log('Chart for week of:', chart.week);
  console.log('Previous week:', chart.previousWeek);
  console.log('Next week:', chart.nextWeek);
});

// List all available charts
listCharts((err, charts) => {
  if (err) {
    console.error('Error:', err);
    return;
  }

  console.log('Available charts:', charts);
});

CommonJS (Legacy)

const { getChart, listCharts } = require('@aribradshaw/billboard-top-100');

// Same usage as above

API Reference

getChart(chartName, date, callback)

Fetches a specific Billboard chart.

Parameters:

  • chartName (string): The name of the chart (e.g., 'hot-100', 'latin-songs', 'artist-100')
  • date (string, optional): The date in YYYY-MM-DD format. If omitted, gets the current week's chart
  • callback (function): Callback function with signature (error, chart)

Returns:

  • chart object with the following structure:
    {
      week: '2023-12-30',
      previousWeek: {
        date: '2023-12-23',
        url: 'http://www.billboard.com/charts/hot-100/2023-12-23'
      },
      nextWeek: {
        date: '2024-01-06',
        url: 'http://www.billboard.com/charts/hot-100/2024-01-06'
      },
      songs: [
        {
          rank: 1,
          title: 'Song Title',
          artist: 'Artist Name',
          cover: 'https://charts-static.billboard.com/img/...',
          position: {
            positionLastWeek: 1,
            peakPosition: 1,
            weeksOnChart: 14
          }
        }
        // ... more songs
      ]
    }

listCharts(callback)

Lists all available Billboard charts.

Parameters:

  • callback (function): Callback function with signature (error, charts)

Returns:

  • charts array with objects containing:
    [
      {
        name: 'Hot 100',
        url: 'http://www.billboard.com/charts/hot-100'
      }
      // ... more charts
    ]

Available Charts

  • hot-100 - Billboard Hot 100
  • latin-songs - Hot Latin Songs
  • artist-100 - Artist 100
  • And many more! Use listCharts() to see all available charts.

Error Handling

The library uses callback-style error handling:

getChart('hot-100', (err, chart) => {
  if (err) {
    console.error('Error fetching chart:', err);
    return;
  }

  // Use chart data
  console.log(chart);
});

Development

Prerequisites

  • Node.js 18.0.0 or higher
  • npm

Setup

git clone https://github.com/aribradshaw/billboard-top-100.git
cd billboard-top-100
npm install

Running Tests

npm test

Linting

npm run lint

Changes from Original

This fork includes the following improvements over the original library:

  1. Modern Dependencies:

    • Replaced deprecated request package with node-fetch
    • Updated all dependencies to latest versions
    • Removed security vulnerabilities
  2. ES Module Support:

    • Full ES module support with import/export
    • Compatible with modern Node.js applications
    • TypeScript-friendly
  3. Better Error Handling:

    • Improved error messages
    • More robust HTTP request handling
  4. Code Quality:

    • Updated ESLint configuration
    • Better code formatting
    • Removed deprecated code patterns

License

MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Disclaimer

This library scrapes Billboard's website. Please be respectful of their servers and use this library responsibly. Billboard's terms of service should be reviewed before using this library in production applications.

changelog

Changelog

All notable changes to this project will be documented in this file.

[3.0.4] - 2025-01-27

Fixed

  • Complete dependency cleanup: All deprecated packages removed
  • Native fetch implementation: Uses Node.js 18+ native fetch for better performance
  • Regenerated package-lock.json: Synced with updated dependencies
  • Clean npm installs: No more deprecated warnings when installing

[3.0.3] - 2025-01-27

Fixed

  • npm token configuration for automatic publishing
  • CI/CD workflow verification with proper authentication
  • Removed deprecated dependencies: Eliminated node-fetch, har-validator, `uuid@3.4.0, andrequest@2.88.2`
  • Updated to native fetch: Now uses Node.js 18+ native fetch instead of node-fetch
  • Updated all dependencies: Upgraded to latest stable versions

[3.0.2] - 2025-01-27

Fixed

  • Final CI/CD workflow fixes and version bump

[3.0.1] - 2025-01-27

Fixed

  • Fixed CI/CD workflow to use Node.js 18 instead of 16
  • Resolved npm publish workflow Node.js version mismatch

[3.0.0] - 2025-01-27

Added

  • Node.js 18+ support for better performance and modern features
  • Improved test reliability with extended timeouts
  • Updated CI/CD pipeline to test against Node.js 18 and 20

Changed

  • BREAKING: Minimum Node.js version changed from 16+ to 18+
  • Updated all dependencies to latest stable versions
  • Enhanced error handling and HTTP request reliability

Fixed

  • Resolved ReadableStream is not defined error that was breaking CI/CD
  • Fixed timeout issues in listCharts() test
  • Improved test stability across different environments

Technical Details

  • Updated package.json engines field to require Node.js >=18.0.0
  • Modified GitHub Actions workflow to test against Node.js 18 and 20
  • Updated dependencies including cheerio, node-fetch, and other packages
  • Extended test timeout for listCharts() function from 10s to 30s

[2.x.x] - Previous versions

This is a fork of the original billboard-top-100 library with modern updates.