Skip to content

hakonhk/YouTube-Video-To-Spotify-Playlist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

From a Youtube video to a Spotify Playlist

Generate Tracklists from DJ sets/mixes

This project allows you to generate a Spotify playlist from a YouTube DJ set. It splits the audio into segments, and leverages the Shazam API to identify songs in the DJ set and the Spotify API to create a playlist with the identified tracks. It's not flawless and often hallucinates, especially when DJs mix songs heavily or play unreleased music.

Features

  • Download Audio: Downloads audio from a YouTube video.
  • Analyze Audio: Splits the audio into segments and uses Shazam to identify tracks.
  • Generate Playlist: Creates a Spotify playlist with the identified tracks.

Practical Limitations: These categories are often mis-recognized / create hallucinations

  • Live Performance
  • Heavily mixed/altered songs: DJs often use filters, FX, Pitch Modulation, Tempo stretch, transitions, etc.
  • Quickly changing tracks: DJs often quickly swap between different tracks (ex. on the drop)
  • Unreleased music (random similar song will often be added)
  • Other hallucinations: Shazam isn't perfect and it will get some songs wrong. Limitations here will be like the limitations of Shazam. If Shazam can't find it, this can't either.

Technical Limitations

  • Very unoptimized in this state

Installation

  1. Clone the repository:

    git clone https://github.com/hakonhk/YouTube-To-Spotify-Playlist.git
    cd YouTube-To-Spotify-Playlist
  2. Install the required Python packages:

    pip install -r requirements.txt
  3. Create a .env file in the root directory and add your Spotify API credentials:

    SPOTIPY_CLIENT_ID=your_spotify_client_id
    SPOTIPY_CLIENT_SECRET=your_spotify_client_secret

Usage

  1. Run the Flask app:

    python run.py
  2. Open your browser and go to http://localhost:5000.

  3. Enter the YouTube URL of the DJ set and click "Analyze and make playlist".

  4. The app will:

    • Download the audio from the YouTube video.
    • Segment the audio into processable sizes.
    • Analyze the audio to identify tracks using Shazam.
    • Create a Spotify playlist with the identified tracks.

Contributing

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes.
  4. Commit your changes (git commit -am 'Add new feature').
  5. Push to the branch (git push origin feature-branch).
  6. Create a new Pull Request.

License

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

Acknowledgements


Feel free to open an issue if you have any questions or run into any problems!