https://github.com/dammyaa7/song-recommendations
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: DammyAA7
- Language: JavaScript
- Default Branch: heroku
- Size: 599 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
SPOTIFY FRIEND SONG RECOMMENDATION TOOL
Discover Music, Share Joy, Connect Instantly
A Flask-based API that leverages the Spotify Web API for user authentication and song recommendations. The application uses a PostgreSQL(Supabase) database to store user data, recommendations, and OAuth tokens.
Features
- Spotify OAuth 2.0 Integration: Securely authenticate users via their Spotify accounts.
- Persistent Sessions: Keeps users logged in across sessions.
- Token Management: Automatically handles refreshing of expired access tokens.
- User Profile: Fetches and stores user profile information from Spotify.
- Chrome Extension: A companion browser extension to interact with the API from the browser.
- Song Recommendations:
- Recommend songs to other users.
- Get recommendations from other users.
- Get recommendations based on an artist's genre.
Technologies
Built with the tools and technologies:
Prerequisites
- Python 3.8 or higher
pipfor package management- A PostgreSQL database instance (the free tier from Supabase is a good option)
- A Spotify Developer account and an application to get API credentials.
Installation & Setup
Backend
Clone the repository
bash git clone https://github.com/DammyAA7/song-recommendations.git cd song-recommendationsCreate and activate a virtual environment
bash python3 -m venv .venv source .venv/bin/activate # On macOS/Linux .venv\Scripts\activate.bat # On WindowsInstall dependencies
bash pip install -r requirements.txtSet up Environment Variables
Create a file named
.envin the root of the project and add the following variables. These are essential for connecting to the database and the Spotify API.```ini
PostgreSQL Database URL
DATABASEURL="postgresql://USER:PASSWORD@HOST:PORT/DATABASENAME"
Spotify API Credentials
SPOTIFYCLIENTID="yourspotifyclientid" SPOTIFYCLIENTSECRET="yourspotifyclientsecret" SPOTIFYREDIRECTURI="http://127.0.0.1:5000/callback"
Flask Session Secret Key
SESSIONSECRETKEY="astrongandrandomsecret_key" ```
Note: For the
SPOTIFY_REDIRECT_URI, make sure to add this exact URI to your Spotify application settings on the developer dashboard.Database Setup
The
schema.sqlfile contains the necessary SQL commands to create the database tables. Connect to your PostgreSQL instance and run the script.bash psql -d YOUR_DATABASE_NAME -a -f schema.sqlRun the application
bash flask runThe server will run at
http://127.0.0.1:5000/.
Chrome Extension
- Open Chrome and navigate to
chrome://extensions. - Enable Developer mode by toggling the switch in the top-right corner.
- Click on the "Load unpacked" button.
- Select the
Extensionfolder from this project's directory.
API Endpoints
Authentication
GET /loginInitiates the Spotify authentication process. Returns a JSON object with the Spotify authorization URL.
GET /callbackThe redirect URI after the user authorizes the application on Spotify. It exchanges the authorization code for an access token and refresh token, stores them, and fetches the user's profile.
GET /check_authChecks if the current user is authenticated. Requires a valid session cookie.
POST /logoutLogs the user out by clearing the session.
Recommendations
PUT /recommendRecommends a song to another user. Requires a JSON body with
user_id,friend_id, andsong_id.GET /recommend/user/<user_id>Gets a list of songs recommended to a specific user.
GET /recommend/artist/<song_id>Gets song recommendations based on the genre of the artist of the given
song_id.
License
This project is released under the MIT License. Feel free to copy, modify, and share.
Owner
- Name: Oluwadamilola Adebayo
- Login: DammyAA7
- Kind: user
- Repositories: 1
- Profile: https://github.com/DammyAA7
GitHub Events
Total
- Push event: 28
Last Year
- Push event: 28