https://github.com/hakonhk/youtube-video-to-spotify-playlist
Transform YouTube DJ sets into Spotify playlists
https://github.com/hakonhk/youtube-video-to-spotify-playlist
music-recognition shazam shazam-api song-recognition spotify spotify-api tracklist youtube yt-dlp
Last synced: 21 days ago
JSON representation
Transform YouTube DJ sets into Spotify playlists
- Host: GitHub
- URL: https://github.com/hakonhk/youtube-video-to-spotify-playlist
- Owner: hakonhk
- Created: 2024-09-15T16:31:02.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-10-02T08:41:35.000Z (7 months ago)
- Last Synced: 2024-11-01T23:07:04.558Z (6 months ago)
- Topics: music-recognition, shazam, shazam-api, song-recognition, spotify, spotify-api, tracklist, youtube, yt-dlp
- Language: Python
- Homepage:
- Size: 219 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# From a Youtube video to a Spotify Playlist
## Generate Tracklists from DJ sets/mixesThis 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:
```sh
git clone https://github.com/hakonhk/YouTube-To-Spotify-Playlist.git
cd YouTube-To-Spotify-Playlist
```2. Install the required Python packages:
```sh
pip install -r requirements.txt
```3. Create a `.env` file in the root directory and add your Spotify API credentials:
```env
SPOTIPY_CLIENT_ID=your_spotify_client_id
SPOTIPY_CLIENT_SECRET=your_spotify_client_secret
```## Usage
1. Run the Flask app:
```sh
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](LICENSE) file for details.
## Acknowledgements
- [Spotipy](https://spotipy.readthedocs.io/)
- [Shazamio](https://github.com/dotX12/shazamio)
- [yt-dlp](https://github.com/yt-dlp/yt-dlp)---
Feel free to open an issue if you have any questions or run into any problems!