Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lttkgp/metadata-extractor
Extract song metadata from YouTube links with Spotify API
https://github.com/lttkgp/metadata-extractor
hacktoberfest metadata-extraction spotify-api youtube
Last synced: 3 months ago
JSON representation
Extract song metadata from YouTube links with Spotify API
- Host: GitHub
- URL: https://github.com/lttkgp/metadata-extractor
- Owner: lttkgp
- License: mit
- Created: 2020-04-09T06:25:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T22:09:10.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T19:02:13.169Z (3 months ago)
- Topics: hacktoberfest, metadata-extraction, spotify-api, youtube
- Language: Python
- Homepage:
- Size: 94.7 KB
- Stars: 14
- Watchers: 4
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://developer.spotify.com/dashboard/applications).
Similarly, you can get `GOOGLE_APPLICATION_CREDENTIALS` by creating a new project on the [Google Developer Console](https://console.developers.google.com/). Enable the `YouTube Data API` and create credentials. Use the API key you get in the `GOOGLE_APPLICATION_CREDENTIALS`.
## Usage
Example
```python
from music_metadata_extractor import SongData
data = SongData("https://www.youtube.com/watch?v=xwtdhWltSIg")
print(data)
```
The output is in the format
```
,
artists=[],
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.