Convert YouTube Music playlists to Spotify playlists effortlessly!
This project is a web application that allows users to convert YouTube Music playlists into Spotify playlists. It leverages the YouTube Data API to fetch songs from a YouTube Music playlist and then adds them to a new Spotify playlist using the Spotify Web API.
- Fetch songs from a YouTube Music playlist using the YouTube Data API.
- Create a new Spotify playlist with a custom name and description.
- Automatically add songs to the Spotify playlist based on their titles.
Before you begin, ensure you have met the following requirements:
- Node.js and npm installed on your machine.
- Spotify Developer Account: You'll need to register a Spotify Developer account to obtain your Spotify API credentials (Client ID, Client Secret, and Redirect URI).
- Youtube Developer Account: You'll need to register a Youtube Developer account to obtain your YoutubeData credentials (Youtube data API key).
Follow these steps to set up the project:
-
Clone the repository to your local machine:
git clone https://github.com/Lux-27/playlistConverter.git
-
Navigate to the project directory
cd playlistConverter
-
Install the dependencies:
npm install
To use this application, you need to obtain API keys and credentials for both Spotify and YouTube Data API and specify them directly in the code.
- Create a Spotify Developer Application:
- Go to the Spotify Developer Dashboard.
- Click on "Create an App" and fill in the necessary details.
- Obtain your Spotify API credentials:
- Note down your "Client ID", "Client Secret", and "Redirect URI".
- Configure the application:
- Open the
spotify.jsx
file. - Replace the placeholders in the
spotify.jsx
ANDSongList.jsx
file with your Spotify API credentials directly in the code:
const clientId = 'your-client-id';
const redirectUri = 'your-redirect-uri';
- Go to the Google Developers Console.
- Create a new project or select an existing project.
- Enable the YouTube Data API for your project.
- Create credentials:
- Go to the "Credentials" page.
- Click "Create Credentials" and select "API Key."
- Note down your API Key.
- Configure the application:
- Open the
SongList.jsx
file. - Replace the placeholders in the
SongList.jsx
file with your YouTube Data API key directly in the code:
const YOUTUBE_API_KEY = "";
The Spotify API is refreshed every 10 minutes to prevent errors, sometimes the token can get automatically refreshed and u might get an error. If that happens, refresh console page and log into spotify again to solve.
- Start the application:
npm run dev
-
Open your web browser and navigate to
http://localhost:3000
. -
Enter the YouTube Music playlist URL and the desired Spotify playlist name and description.
-
Click the "Fetch Songs" button.
-
The application will fetch songs from the YouTube Music playlist and create a JSON file with the song data.
-
Log in to your Spotify account when prompted.
-
The application will create a new Spotify playlist with the provided name and description.
-
It will then search for each song in the Spotify library and add them to the playlist.
-
Once the process is complete, all songs will be added to the Spotify playlist.
Contributions are welcome! If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix: git checkout -b feature/your-feature-name or git checkout -b bugfix/your-bug-fix.
- Make your changes and commit them with descriptive messages.
- Push your changes to your fork: git push origin feature/your-feature-name or git push origin bugfix/your-bug-fix.
- Open a pull request to the main branch of the original repository.