A fully-fledged installable python package for extracting top 200 and viral 50 charts off of spotifycharts.com
Project description
fycharts
A fully-fledged installable python package for extracting top 200 and viral 50 charts off of spotifycharts.com
In a nutshell, the unofficial Spotify Charts API
INSPIRATION
This was built to fill the gap left when Spotify deprecated their official Spotify charts API. It arose as a needed crawler for the Spotify data analysis and machine learning project done here
INSTALLATION
pip install fycharts
SAMPLE USAGE
Say you want to extract top 200 daily charts for all time, all regions
myCrawler.py
from fycharts import SpotifyCharts
api = SpotifyCharts.SpotifyCharts()
api.top200Daily(output_file = 'top_200_daily.csv')
Run your program.
python myCrawler.py
Watch the terminal for helpful information.
FUNCTIONS AND PARAMETERS
Four functions, for all data you need are required:
- top200Weekly
- top200Daily
- viral50Weekly
- viral50Daily
All four functions take the following parameters:
Compulsory
- output_file - CSV file to dump the data.
Optional
- start - Start date of range of interest as string YYYY-MM-DD
- end - End date of range of interest as string YYYY-MM-DD
- region - Region of interest, as a country abbreviation code. 'global' is also valid
Refer to 'SUPPORTED COUNTRY CODES SO FAR' below for important information of this.
If not included, data is extracted for all dates, all regions
DATA RETURNED
The data extracted from spotifycharts.com is written into a CSV file with the following fields:
- position - The song's position during that week or day
- track name - Name of the song
- artist - Name of artist
- region - Region of the chart as a code
- date - Date or range of dates of chart
- id - Spotify track id
- streams - Number of streams for that week or day. Only applicable to top 200 charts
SUPPORTED COUNTRY CODES SO FAR
ad | ca | dk | gr | is | mx | ph | sv |
ar | ch | do | gt | it | my | pl | th |
at | cl | ec | hk | jp | ni | pt | tr |
au | co | ee | hn | lt | nl | py | tw |
be | cr | es | hu | lu | no | ro | us |
bg | cy | fi | id | lv | nz | se | uy |
bo | cz | fr | ie | mc | pa | sg | vn |
br | de | gb | il | mt | pe | sk | global |
PASSING DATES AS PARAMETERS
If the date isn't valid, you shall be notified with a list of the closest dates to what you put in, as suggestions.
STUFF YOU SHOULD KNOW
When extracting data for a range of dates, in loop, the crawler sleeps every iteration for a random number of seconds between 0 and the index of the date. Dig into the code to change this!!!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fycharts-1.2.0.tar.gz
.
File metadata
- Download URL: fycharts-1.2.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6680fad43ba6311471b4ce97f455e93114ae6e01cd997919b0f9552ef4b2f286 |
|
MD5 | 8a621597acec240c9dbc85432298ef0a |
|
BLAKE2b-256 | 1125ce2b3dbba3c409807025ca5fb69dd28218037b7189b32b907f0093a72c50 |
File details
Details for the file fycharts-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: fycharts-1.2.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/2.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 635291f2ed014fae80b7e8c75ff07fdfae9f59fe038a0749f3475f2afa0d2994 |
|
MD5 | de6fe759ef7e3a1817db4800f4ca602a |
|
BLAKE2b-256 | 85c6afbc47f4c0b6da96e2f8969e174f01686a2eeaa6e0d95c2148364935d3b9 |