This is a Flask application that fetches and displays various statistics about a Spotify artist using the Spotify Web API. It retrieves data such as followers count, popularity, and listeners for the artist's top tracks. The fetched data is processed and stored in a database for historical tracking.
Before running this application, make sure you have the following:
-
Python 3.x installed
-
Required Python packages installed. You can install them using the following command:
pip install -r requirements.txt
To get started with this application, follow these steps:
-
Clone the repository:
git clone https://github.com/your-username/spotify-artist-stats.git
-
Change to the project directory:
cd spotify-artist-stats
-
Open the
app.py
file and replace theclient_id
andclient_secret
variables with your own Spotify Developer credentials. If you don't have them, you can create a Spotify Developer account and create a new application to obtain the credentials. -
Create the necessary database tables by running the following command:
python database.py
-
Start the Flask development server:
python app.py
-
Open your web browser and visit
http://localhost:5000
to access the application.
- On the homepage, you will see basic information about the Spotify artist.
- Click the "Fetch Data" button to fetch the latest data from the Spotify API and store it in the database.
- The fetched data includes the latest track's popularity, number of listeners, and the percentage difference compared to the previous track.
- The historical data is displayed in a table below the latest data.
- The database stores the data for the specific artist, identified by the
artist_id
. - You can modify the
artist_id
in the code to fetch data for a different artist.
This project is licensed under the MIT License. See the LICENSE file for details.
- Flask - Python web framework
- Spotify Web API - API for accessing Spotify data