Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emmanuelbeziat/get-audio-id
π JS tool to parse audio services (Spotify, Deezer, YouTube) url to get a song ID
https://github.com/emmanuelbeziat/get-audio-id
javascript javascript-tools spotify
Last synced: about 1 month ago
JSON representation
π JS tool to parse audio services (Spotify, Deezer, YouTube) url to get a song ID
- Host: GitHub
- URL: https://github.com/emmanuelbeziat/get-audio-id
- Owner: EmmanuelBeziat
- License: mit
- Created: 2019-02-16T02:42:00.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-16T18:12:55.000Z (6 months ago)
- Last Synced: 2024-11-07T09:05:29.185Z (about 2 months ago)
- Topics: javascript, javascript-tools, spotify
- Language: JavaScript
- Homepage:
- Size: 61.5 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π get-audio-id
JS tool to parse music streaming services url (Spotify, Deezer, Youtube, β¦) to get a song ID.> *Important Note:* This work is a fork-ish of [get-video-id](https://github.com/radiovisual/get-video-id) from [@radiovisual](https://github.com/radiovisual), but meant to use audio services (Spotify, Deezer, etc.). Credits for the work should go to him.
# Purpose
This module will extract the Spotify, Deezer, including embed strings.
> Wait, why would I want to do that?
Thatβs a good question, thanks for asking.
Letβs say you want your users to easily share their favorites songs. You can either share them a long list of tutorials to correctly embed players from multiple services, and hope that they donβt mess up (they will). Or, you can just as them for any kind of url/share protocol from any service, and then just treat the data to render the correct player with the desired song.
Thatβs what this little tool is used for.
# Install
```bash
$ npm install --save get-audio-id
```# Usage
Just call the class with a spotify/deezer url (or embed string) as a parameter. Its metadata (id and service) will be extracted.
```javascript
import GetAudioId from 'get-audio-id'const audio = new GetAudioId('spotify:track:5uunXHE4kIW6uS4HWAXaOQ')
audio.getId()
// => {id: '5uunXHE4kIW6uS4HWAXaOQ', service: 'spotify' }
```You can throw it a few types of url/strings:
```
'spotify:track:5uunXHE4kIW6uS4HWAXaOQ',
'https://open.spotify.com/track/5uunXHE4kIW6uS4HWAXaOQ',
'https://open.spotify.com/track/5uunXHE4kIW6uS4HWAXaOQ?si=6DD5tNAsRWieSursZHRm0A',
'',
'https://www.deezer.com/en/track/126338363',
'https://www.youtube.com/watch?v=iVvXB-Vwnco',
'https://www.youtube.com/watch?v=iVvXB-Vwnco&feature=youtu.be&t=172',
'https://youtu.be/iVvXB-Vwnco',
'https://youtu.be/iVvXB-Vwnco?t=106',
''
```# Need more services?
If you need this tool to be enhanced with more string formats, more services, etc., you can either [open a Ticket](https://github.com/EmmanuelBeziat/get-audio-id/issues/new[) and ask me, or [submit a pull request](https://github.com/EmmanuelBeziat/get-audio-id/compare) of your work (just please follow the same coding guidelines).
# License
MIT