metadata-extractor
Package to fetch music metadata from common Music APIs from a variety of data sources.
Currently, YouTube, YouTube Music and Spotify links are supported and data is fetched from Spotify APIs.
Installation
pip install music-metadata-extractor
Ensure that the .env file for your project has all the environment variables defined in .env.template.
SPOTIPY_CLIENT_ID and SPOTIPY_CLIENT_SECRET can be obtained by creating a new app on the Spotify Developer Dashboard.
Similarly, you can get GOOGLE_APPLICATION_CREDENTIALS by creating a new project on the Google Developer Console. Enable the YouTube Data API and create credentials. Use the API key you get in the GOOGLE_APPLICATION_CREDENTIALS.
Usage
Example
from music_metadata_extractor import SongData
data = SongData("https://www.youtube.com/watch?v=xwtdhWltSIg")
print(data)
The output is in the format
<SongData(
track=<Track(provider_id=31AOj9sFz2gM0O3hMARRBx, name=Losing My Religion, is_cover=False, original_id=None,popularity=82, year=1991-03-12, explicit=False, image_id=https://i.scdn.co/image/ab67616d0000b273e2dd4e821bcc3f70dc0c8ffd, genres=[])>,
artists=[<Artist(provider_id=4KWTAlx2RvbpseOGMEmROg, name=R.E.M., image_id=https://i.scdn.co/image/d24ff8fbfd6688b345a5d53acff032d2ac1ff387, genres=['alternative rock', 'classic rock', 'permanent wave', 'pop rock', 'rock'])>],
extraAttrs={'youtube': {'title': 'R.E.M. - Losing My Religion (Official Music Video)', 'views': '770535535', 'posted_date': datetime.datetime(2011, 7, 2, 0, 30, 31, tzinfo=tzutc()), 'converted_link': 'https://www.youtube.com/watch?v=xwtdhWltSIg'}}
)>
music.youtube.com/watch links and open.spotify.com/track/ are also supported as inputs to SongData.
YouTube Music and Spotify links are converted to their equivalent YouTube links and returned in the converted_link field of the extraAttrs attribute.
Release files for music-metadata-extractor 1.4.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 | |
|---|---|---|---|
| music_metadata_extractor-1.4.0.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| music_metadata_extractor-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.0 kB
Release files / music_metadata_extractor-1.4.0.tar.gz
| Download URL | music_metadata_extractor-1.4.0.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1bb036921a8a7a2fa18c7b4631b6003e2c2418bc6a1d72e8b11b4b7383469de1
|
|
BLAKE2b-256 checksum How to use checksums |
d1c2a96d154f6b84e3022057a7d8d8f5937c2d44ed722c01428fb1095e733831
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
|
Release files / music_metadata_extractor-1.4.0-py3-none-any.whl
| Download URL | music_metadata_extractor-1.4.0-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b777548db2b73bd3ca281099812e003bc0f39e5233e0ea0228f0904173fe4aa
|
|
BLAKE2b-256 checksum How to use checksums |
ce8e8ed3581ae7c70e44b1f7669d03d92eb73948844687deaf1286ed8c8d6572
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.11
|