Skip to main content

Fetch music metadata from common Music APIs for a variety of data sources

Project description

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.

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

music_metadata_extractor-1.3.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

music_metadata_extractor-1.3.3-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file music_metadata_extractor-1.3.3.tar.gz.

File metadata

  • Download URL: music_metadata_extractor-1.3.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.6

File hashes

Hashes for music_metadata_extractor-1.3.3.tar.gz
Algorithm Hash digest
SHA256 a698a9cfcbfeb0af0043c9f64ac5a98ede9fa6c9a72a34eb2a43d6f6ee48e6cc
MD5 fc9705bd38447576815c4d25905c55ed
BLAKE2b-256 42decfece2ca4f36844bff98ce0d011fe639f5ff7c823f9d8ce1692da153ee70

See more details on using hashes here.

File details

Details for the file music_metadata_extractor-1.3.3-py3-none-any.whl.

File metadata

  • Download URL: music_metadata_extractor-1.3.3-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.6

File hashes

Hashes for music_metadata_extractor-1.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 30649c3662db780b05a3f871b85d982fbc4390632074a34e829c82a67286c67e
MD5 b9809117a7cf74b2bb1f0226455e9c35
BLAKE2b-256 b82436b578f3d5cd4af9037a52b67afc5b0c24974a6d98ea1ebc2d47ff7ea8f8

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