Skip to main content

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:

  1. top200Weekly
  2. top200Daily
  3. viral50Weekly
  4. viral50Daily

All four functions take the following parameters:

Compulsory

  1. output_file - CSV file to dump the data.

Optional

  1. start - Start date of range of interest as string YYYY-MM-DD
  2. end - End date of range of interest as string YYYY-MM-DD
  3. 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:

  1. position - The song's position during that week or day
  2. track name - Name of the song
  3. artist - Name of artist
  4. region - Region of the chart as a code
  5. date - Date or range of dates of chart
  6. id - Spotify track id
  7. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fycharts-1.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

fycharts-1.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for fycharts-1.2.0.tar.gz
Algorithm Hash digest
SHA256 6680fad43ba6311471b4ce97f455e93114ae6e01cd997919b0f9552ef4b2f286
MD5 8a621597acec240c9dbc85432298ef0a
BLAKE2b-256 1125ce2b3dbba3c409807025ca5fb69dd28218037b7189b32b907f0093a72c50

See more details on using hashes here.

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

Hashes for fycharts-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 635291f2ed014fae80b7e8c75ff07fdfae9f59fe038a0749f3475f2afa0d2994
MD5 de6fe759ef7e3a1817db4800f4ca602a
BLAKE2b-256 85c6afbc47f4c0b6da96e2f8969e174f01686a2eeaa6e0d95c2148364935d3b9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page