The Spotify Mood Analyzer is a React application that connects to the Spotify API to fetch a user's top tracks and artists. It performs sentiment analysis on the lyrics of the top tracks using the Azure Sentiment API and displays the results in a user-friendly interface.
- User Authentication with Spotify
- Fetch and display user's top tracks and artists
- Perform sentiment analysis on top tracks' lyrics using Azure Sentiment API
- Display sentiment analysis results
- Node.js and npm installed
- Spotify Developer account with client credentials
- Azure account for sentiment analysis
- Lyrics API access
- Clone the repository:
git clone https://github.com/mohaimenhasan/Mood-Analyzer.git
cd Mood-Analyzer
- Install the dependencies:
npm install
- Create a
.env
file in the root directory and add your Spotify, Azure, and Lyrics API credentials:
REACT_APP_GENIUS_API_TOKEN=your_lyrics_api_key
REACT_APP_AZURE_SENTIMENT_ENDPOINT=your_azure_endpoint
REACT_APP_AZURE_SENTIMENT_ENDPOINT_KEY=your_azure_key
REACT_APP_SPOTIFY_CLIENT_ID=your_spotify_client_id
REACT_APP_SPOTIFY_REDIRECT_URI=your_spotify_redirect_uri
GENERATE_SOURCEMAP=false
REACT_APP_AZURE_SONG_HANDLER=your_song_handler_to_handle_song
- Start the development server:
npm start
-
Open your browser and navigate to `http://localhost:3000\Mood-Analyzer`.
-
Log in with your Spotify account.
-
View your top tracks, top artists, and mood analysis results.
src/
│
├── apis/
│ ├── azureSentiment.ts
│ ├── azureSongHandler.ts
│ └── spotifyApi.ts
│
├── components/
│ ├── Login.tsx
│ └── TopTracksChart.tsx
│ └── TopArtistsTable.tsx
│ └── SentimentChart.tsx
|
├── App.css
├── App.tsx
├── index.css
├── index.tsx
│
├── ...
- Spotify API: Fetches user data, top tracks, and top artists.
- Azure Sentiment API: Analyzes sentiment of lyrics.
- Azure SongHandler API: Retrieves descriptions for tracks.
- `App.tsx`: Main component that handles authentication, data fetching, and rendering.
- `spotifyApi.ts`: Contains functions to interact with Spotify API.
- `azureSentiment.ts`: Contains function to interact with Azure Sentiment API.
- `lyricsApi.ts`: Contains function to interact with Lyrics API.
- `TopTracksChart.tsx`: Component to display top tracks in a chart.
- `Login.tsx`: Component for user authentication with Spotify.
It is warmly welcomed if you have interest to contribute to Mood-Analyzer.
More details, please refer to CONTRIBUTION.md
This project is licensed under the MIT License.