Spotichart
Collector Module for Spotify National Trending Analysis
Introduction
The Spotichart module makes it easy for data scientist and programmers get the features from the trending songs on Spotify. You can define period of time and a region and get the main characteristics of the top songs.
Documentation
The oficial documentations is available at: Read The Docs
Installation
$ pip install spotichart
Requirements
- Python >= 3.6
- Spotify Web API Access Token, you can request yours here and click on
GET TOKEN. Then copy the token on theOAuth Tokenfield. - (Optional) Genius Web API Access Token. From the official docs page you can just select
Authenticate wih the Docs App To Try, and copy theAuthorization Bearerprovided after logging in.
Synopsis
Usage
Just to get the audio features, given a date (or period) and a region
import spotichart
spotify_token = 'YOUR-ACCESS-TOKEN-FROM-THE-WEB-API'
chart = spotichart.generate_top_chart(spotify_token, start='2019-01-01', end='2019-10-13', region='mx')
To additionally retrieve each song's lyrics, Genius ID an auto-detect the language, you can do as well:
import spotichart
spotify_token = 'YOUR-SPOTIFY-ACCESS-TOKEN-FROM-THE-WEB-API'
genius_token = 'YOUR-GENIUS-ACCESS-TOKEN-FROM-THE-WEB-API'
chart = spotichart.generate_top_chart(spotify_token, start='2019-01-01',
end='2019-10-13', region='mx', sleep=0.5)
chart_with_lyrics = spotichart.get_lyrics_from_chart(genius_token, chart, sleep=0.1)
Note: Since these functions imply web requests to get the data, the sleep parameter is meant to make the algorithm rest and avoid the server to refuse the requests. By default sleep is set to 1 second.
The DataFrame
A pandas.DataFrame will be generated with the data of interest:
>>> chart
Position Track Name Artist Streams ... speechiness tempo time_signature valence
0 1 Calma - Remix Pedro Capó 737894 ... 0.0524 126.899 4 0.761
1 2 Adan y Eva Paulo Londra 415066 ... 0.3360 171.993 4 0.720
2 3 Taki Taki (with Selena Gomez, Ozuna & Cardi B) DJ Snake 409061 ... 0.2290 95.948 4 0.591
3 4 MIA (feat. Drake) Bad Bunny 377855 ... 0.0621 97.062 4 0.158
4 5 A Través Del Vaso Grupo Arranke 346975 ... 0.0297 143.851 3 0.920
... ... ... ... ... ... ... ... ... ...
14295 46 Con Calma Daddy Yankee 141397 ... 0.0593 93.989 4 0.656
14296 47 La Escuela No Me Gustó Adriel Favela 139350 ... 0.0371 112.548 4 0.844
14297 48 De Los Besos Que Te Di Christian Nodal 139294 ... 0.0422 195.593 4 0.709
14298 49 Pa Mí - Remix Dalex 137812 ... 0.2200 170.018 4 0.727
14299 50 Circles Post Malone 131109 ... 0.0395 120.042 4 0.5
[14300 rows x 20 columns]
Metadata
Release files for spotichart 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| spotichart-1.0.0.tar.gz | 10.2 kB | Without provenance | Details for spotichart-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spotichart-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for spotichart-1.0.0-py2.py3-none-any.whl |
Total release size: 22.5 kB
Release files / spotichart-1.0.0.tar.gz
| Download URL | spotichart-1.0.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33f49a2c3e5087d0ae8242ab92f2fe4724c10228249ed5e93b9f034a653bf22a
|
|
BLAKE2b-256 checksum How to use checksums |
e2616a9fc88af96f2e48cb6c1fd2e961f56ccba77fe871f7fe52308d94a1679d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / spotichart-1.0.0-py2.py3-none-any.whl
| Download URL | spotichart-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e344f2a365a3ab88c668853dce668fac738016586b831f3329ca6a9fed356d6c
|
|
BLAKE2b-256 checksum How to use checksums |
cd6e660d424ce0de17650607f9428c84cc9a0eef6ebf42f665e9ce27e9cf4b2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for spotichart 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.