Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 2.25 KB

README.md

File metadata and controls

38 lines (25 loc) · 2.25 KB

Spotify to YouTube Music Converter

This Python program allows you to convert your liked songs from Spotify to a playlist on YouTube Music.

Setup

Before running the program, you need to set up some prerequisites:

  1. Obtain Browser Headers: You need to obtain your browser headers and save them to a file named browser_headers.txt. To do this, follow the instructions below:

    • Open your browser and go to music.youtube.com.
    • Open the Developer Tools (usually by pressing F12 or right-clicking and selecting "Inspect").
    • Go to the "Network" tab.
    • Reload the page.
    • Look for a request named "account_menu" in the list of network requests.
    • Copy the request headers (excluding the "POST" request line) and paste them into a new file named browser_headers.txt.
  2. Spotify API Keys: You need to obtain your Spotify API client ID and client secret. If you don't have them already, you can create an application on the Spotify Developer Dashboard and obtain your keys there.

  3. Install Dependencies: Run pip install -r requirements.txt to install the required Python packages.

How It Works

  1. The program first uses the Spotify API to fetch your liked songs and saves the results to a JSON file named spotify_results.json.
  2. Then, it searches for each song on YouTube Music and adds it to a new playlist.
  3. Finally, it saves the songs that could not be found on YouTube Music to a file named songs_not_found.txt.

Usage

  1. Make sure you have set up the prerequisites as mentioned above.
  2. Run the main.py file using Python 3: python3 main.py.
  3. Follow the prompts to enter your Spotify API client ID and client secret if you haven't already set them up in a .env file.
  4. The program will then proceed to fetch your liked songs from Spotify and add them to a playlist on YouTube Music.

Additional Information

  • The program utilizes the spotipy library to interact with the Spotify API and the ytmusicapi library to interact with the YouTube Music API.
  • If any errors occur during the process, they will be displayed in the console, and any songs that could not be found on YouTube Music will be listed in the songs_not_found.txt file.