The Spotify Hyper & Opposite Playlist Generator is a Python-based tool to generate hyper-focused and polar opposite playlists based on a user's Spotify "for you" playlist. The project uses the Spotify API to fetch relevant playlist and track data to analyze and generate new playlist recommendations.
- Python 3.8+
- Streamlit
- Requests
- Pandas
- Numpy
- python-dotenv
- Pickle
-
Environment Variables: Before running the tool, ensure you have a
.env
file in the project root with the following variable:SPOTIFY_REFRESH_TOKEN=your_spotify_refresh_token
Replace
your_spotify_refresh_token
with your actual Spotify refresh token. -
Python Dependencies: Install the necessary python packages using pip:
pip install requests pandas numpy python-dotenv streamlit
-
Fetching Spotify Data: Utilize the functions provided in
playlist_functions.py
to fetch and process Spotify data. -
Streamlit App: The provided
streamlit
app is an example UI that uses the functions fromplaylist_functions.py
. You can run the app with:streamlit run your_app_filename.py
Replace
your_app_filename.py
with the name of your streamlit script if it's different. -
Enter your Spotify username in the Streamlit app and discover your hyper and opposite playlists!
-
Caching: Data is cached to reduce redundant API calls to Spotify, enhancing the efficiency of the application.
-
Modularity: The codebase is modular, allowing developers to easily expand or modify functionality.
-
Recommendation Engine: The core logic uses audio features to recommend hyper playlists and can be expanded for opposite playlist recommendations.
- Ensure your Spotify refresh token is valid. If the token is invalid, API requests will fail.
- The rate limit for the Spotify API is handled, but excessive requests in a short time might still cause the tool to pause its operation temporarily.
Feel free to fork this project, create a feature branch, and submit a pull request if you wish to contribute.
This project is licensed under the MIT License.
You can customize the README further as per your needs. Adjust the filenames, paths, or descriptions as necessary.