use iitunes api to stop depending on links

This commit is contained in:
amy 2025-03-10 15:41:54 +03:30
parent 27b7f9b5f8
commit da13cdf3e9
No known key found for this signature in database
2 changed files with 44 additions and 46 deletions

View file

@ -32,7 +32,9 @@ const songLinkShape = z.object({
export const preferredProviders = [
"spotify",
"deezer",
"youtubeMusic"
"youtubeMusic",
"tidal",
"itunes"
];
export function getSongOnPreferredProvider(json: any, link: string): Song | null {
@ -44,13 +46,12 @@ export function getSongOnPreferredProvider(json: any, link: string): Song | null
}
const entityId = song.linksByPlatform[platform].entityUniqueId;
const songInfo = song.entitiesByUniqueId[entityId]
return {
title: songInfo.title,
artist: songInfo.artistName,
apiProvider: songInfo.apiProvider,
thumbnailUrl: songInfo.thumbnailUrl,
link
link: song.linksByPlatform[platform].url,
}
}
return null