Skip to content

vatsrounak/AudioHives

Repository files navigation

AudioHives : Spotify Playlist Downloader

This is a Node.js project that allows you to download songs from a Spotify playlist using YouTube as the source. The script uses the Spotify Web API to fetch playlist details, searches for each track on YouTube, and downloads the audio files.

Prerequisites

Before running the script, make sure you have the following installed on your machine:

Installation

  1. Clone this repository to your local machine.
git clone https://github.com/Abhi6722/AudioHives
  1. Change into the project directory.
cd AudioHives
  1. Install the required npm packages.
npm install

Getting Started

  1. Obtain your Spotify API credentials (Client ID and Client Secret) and update them in the config.js file:
// config.js
module.exports = {
    spotify: {
      clientId: 'YOUR_SPOTIFY_CLIENT_ID',
      clientSecret: 'YOUR_SPOTIFY_CLIENT_SECRET',
    },
    youtube: {
      apiKey: 'YOUR_YOUTUBE_API_KEY',
    },
  };

Usage

  1. To start the download process, simply run:
npm start
  1. The script will run the index.js file and then we can open the http://localhost:8888/login and login into our Spotify Account and then after that we can see the Access token in our terminal.
Screenshot 2023-08-06 at 12 59 46 AM
  1. Now we have to copy the access token and paste getMe.js file in the token variable.
const token = "YOUR_GENERATED_ACCESS_TOKEN";
  1. Now we have to run the getMe.js file in another terminal using the command
node getMe.js
  1. The script will fetch the playlist details from Spotify, search for each track on YouTube, and download the audio files. The downloaded songs will be saved in the songs directory.
Screenshot 2023-08-06 at 1 01 16 AM

Notes

  • Make sure you have the required npm packages installed as mentioned in the package.json file.
  • The script will download the audio of the first YouTube search result for each track. If you want to customize this behavior, you can modify the downloadYouTubeVideo function in the youtube.js file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This project uses the Spotify Web API and YouTube API to fetch playlist details and download songs, respectively.

About

A central place to collect and store audio tracks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors