spotify-url-info
Advanced tools
Comparing version 3.0.7 to 3.1.0
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/microlinkhq/spotify-url-info", | ||
"version": "3.0.7", | ||
"version": "3.1.0", | ||
"main": "src/index.js", | ||
@@ -16,2 +16,26 @@ "author": { | ||
"email": "josefrancisco.verdu@gmail.com" | ||
}, | ||
{ | ||
"name": "DaliborTrampota", | ||
"email": "dalibor.trampota@gmail.com" | ||
}, | ||
{ | ||
"name": "crxts", | ||
"email": "49580728+crxts@users.noreply.github.com" | ||
}, | ||
{ | ||
"name": "kaaax0815", | ||
"email": "999999bst@gmail.com" | ||
}, | ||
{ | ||
"name": "kaname-png", | ||
"email": "inmortaldragonxspace@outlook.com" | ||
}, | ||
{ | ||
"name": "KeepSOBP", | ||
"email": "keepsobp@naver.com" | ||
}, | ||
{ | ||
"name": "D3SOX", | ||
"email": "d3sox@protonmail.com" | ||
} | ||
@@ -18,0 +42,0 @@ ], |
@@ -25,6 +25,6 @@ <div align="center"> | ||
const fetch = require('isomorphic-unfetch') | ||
const { getData, getPreview, getTracks } = require('spotify-url-info')(fetch) | ||
const { getData, getPreview, getTracks, getDetails } = require('spotify-url-info')(fetch) | ||
``` | ||
There are two functions: | ||
There are four functions: | ||
@@ -40,2 +40,5 @@ - **getData**<br/> | ||
- **getDetails** <br/> | ||
Returns both the preview and tracks. Should be used if you require information from both of them so that only one request is made. | ||
All the methods receive a Spotify URL (play. or open.) as first argument: | ||
@@ -42,0 +45,0 @@ |
@@ -6,2 +6,3 @@ declare module "spotify-url-info" { | ||
getTracks(url: string, options?: object): Promise<Tracks[]>; | ||
getDetails(url: string, options?: object): Promise<{preview: Preview, tracks: Tracks[]}>; | ||
} | ||
@@ -8,0 +9,0 @@ |
@@ -196,4 +196,9 @@ 'use strict' | ||
getPreview: (url, opts) => getData(url, opts).then(getPreview), | ||
getTracks: (url, opts) => getData(url, opts).then(getTracks) | ||
getTracks: (url, opts) => getData(url, opts).then(getTracks), | ||
getDetails: (url, opts) => | ||
getData(url, opts).then(data => ({ | ||
preview: getPreview(data), | ||
tracks: getTracks(data) | ||
})) | ||
} | ||
} |
13621
223
86