mirror of
https://github.com/d-fi/d-fi-core.git
synced 2025-07-28 08:04:43 +02:00
support short link
This commit is contained in:
parent
403fd527fd
commit
76e2181010
@ -8,6 +8,7 @@ import {
|
||||
getTrackInfo,
|
||||
} from '../';
|
||||
import spotifyUri from 'spotify-uri';
|
||||
import axios from 'axios';
|
||||
import * as spotify from './spotify';
|
||||
import * as tidal from './tidal';
|
||||
import * as youtube from './youtube';
|
||||
@ -50,6 +51,10 @@ export const getUrlParts = async (url: string, setToken = false): Promise<urlPar
|
||||
|
||||
switch (site[0]) {
|
||||
case 'deezer':
|
||||
if (url.includes('page.link')) {
|
||||
const {request} = await axios.head(url);
|
||||
url = request.res.responseUrl;
|
||||
}
|
||||
const deezerUrlParts = url.split(/\/(\w+)\/(\d+)/);
|
||||
return {type: deezerUrlParts[1] as any, id: deezerUrlParts[2]};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user