UNPKG

spotify-find-preview

Version:

Get Spotify song preview URLs along with song details. Now supports searching by song name and artist for improved accuracy. Modern TypeScript module with full type support.

44 lines 1.31 kB
/** * Track information returned by the search */ export interface TrackInfo { name: string; spotifyUrl: string; previewUrls: string[]; trackId: string; albumName: string; releaseDate: string; popularity: number; durationMs: number; } /** * Search result containing all tracks found */ export interface SearchResult { success: boolean; searchQuery?: string; results: TrackInfo[]; error?: string; } /** * Search for songs and get their preview URLs * @param songName - The name of the song to search for * @param artistOrLimit - Artist name (string) or limit (number) for backward compatibility * @param limit - Maximum number of results to return (only used when artistOrLimit is a string) * @returns Promise resolving to search results with track information * * @example * // Basic search * await searchAndGetLinks('Shape of You'); * * @example * // Search with limit * await searchAndGetLinks('Shape of You', 3); * * @example * // Search with artist for better accuracy * await searchAndGetLinks('Shape of You', 'Ed Sheeran', 2); */ export declare function searchAndGetLinks(songName: string, artistOrLimit?: string | number, limit?: number): Promise<SearchResult>; export default searchAndGetLinks; //# sourceMappingURL=index.d.ts.map