@ziplayer/plugin 0.0.5 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SoundCloudPlugin.d.ts +149 -0
- package/dist/SoundCloudPlugin.d.ts.map +1 -1
- package/dist/SoundCloudPlugin.js +149 -0
- package/dist/SoundCloudPlugin.js.map +1 -1
- package/dist/SpotifyPlugin.d.ts +127 -5
- package/dist/SpotifyPlugin.d.ts.map +1 -1
- package/dist/SpotifyPlugin.js +127 -5
- package/dist/SpotifyPlugin.js.map +1 -1
- package/dist/TTSPlugin.d.ts +123 -2
- package/dist/TTSPlugin.d.ts.map +1 -1
- package/dist/TTSPlugin.js +114 -0
- package/dist/TTSPlugin.js.map +1 -1
- package/dist/YouTubePlugin.d.ts +148 -0
- package/dist/YouTubePlugin.d.ts.map +1 -1
- package/dist/YouTubePlugin.js +148 -0
- package/dist/YouTubePlugin.js.map +1 -1
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/SoundCloudPlugin.ts +149 -0
- package/src/SpotifyPlugin.ts +312 -190
- package/src/TTSPlugin.ts +130 -3
- package/src/YouTubePlugin.ts +528 -380
- package/src/index.ts +82 -0
|
@@ -1,21 +1,170 @@
|
|
|
1
1
|
import { BasePlugin, Track, SearchResult, StreamInfo } from "ziplayer";
|
|
2
|
+
/**
|
|
3
|
+
* A plugin for handling SoundCloud audio content including tracks, playlists, and search functionality.
|
|
4
|
+
*
|
|
5
|
+
* This plugin provides comprehensive support for:
|
|
6
|
+
* - SoundCloud track URLs (soundcloud.com)
|
|
7
|
+
* - SoundCloud playlist URLs
|
|
8
|
+
* - SoundCloud search queries
|
|
9
|
+
* - Audio stream extraction from SoundCloud tracks
|
|
10
|
+
* - Related track recommendations
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
*
|
|
14
|
+
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
15
|
+
*
|
|
16
|
+
* // Add to PlayerManager
|
|
17
|
+
* const manager = new PlayerManager({
|
|
18
|
+
* plugins: [soundcloudPlugin]
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* // Search for tracks
|
|
22
|
+
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
23
|
+
*
|
|
24
|
+
* // Get audio stream
|
|
25
|
+
* const stream = await soundcloudPlugin.getStream(result.tracks[0]);
|
|
26
|
+
*
|
|
27
|
+
* @since 1.0.0
|
|
28
|
+
*/
|
|
2
29
|
export declare class SoundCloudPlugin extends BasePlugin {
|
|
3
30
|
name: string;
|
|
4
31
|
version: string;
|
|
5
32
|
private client;
|
|
6
33
|
private ready;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new SoundCloudPlugin instance.
|
|
36
|
+
*
|
|
37
|
+
* The plugin will automatically initialize the SoundCloud client for track
|
|
38
|
+
* and playlist operations. Initialization is asynchronous and handled internally.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const plugin = new SoundCloudPlugin();
|
|
42
|
+
* // Plugin is ready to use after initialization completes
|
|
43
|
+
*/
|
|
7
44
|
constructor();
|
|
8
45
|
private init;
|
|
46
|
+
/**
|
|
47
|
+
* Determines if this plugin can handle the given query.
|
|
48
|
+
*
|
|
49
|
+
* @param query - The search query or URL to check
|
|
50
|
+
* @returns `true` if the plugin can handle the query, `false` otherwise
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* plugin.canHandle("https://soundcloud.com/artist/track"); // true
|
|
54
|
+
* plugin.canHandle("chill music"); // true
|
|
55
|
+
* plugin.canHandle("spotify:track:123"); // false
|
|
56
|
+
*/
|
|
9
57
|
canHandle(query: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Validates if a URL is a valid SoundCloud URL.
|
|
60
|
+
*
|
|
61
|
+
* @param url - The URL to validate
|
|
62
|
+
* @returns `true` if the URL is a valid SoundCloud URL, `false` otherwise
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* plugin.validate("https://soundcloud.com/artist/track"); // true
|
|
66
|
+
* plugin.validate("https://www.soundcloud.com/artist/track"); // true
|
|
67
|
+
* plugin.validate("https://youtube.com/watch?v=123"); // false
|
|
68
|
+
*/
|
|
10
69
|
validate(url: string): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Searches for SoundCloud content based on the given query.
|
|
72
|
+
*
|
|
73
|
+
* This method handles both URL-based queries (direct track/playlist links) and
|
|
74
|
+
* text-based search queries. For URLs, it will extract track or playlist information.
|
|
75
|
+
* For text queries, it will perform a SoundCloud search and return up to 10 results.
|
|
76
|
+
*
|
|
77
|
+
* @param query - The search query (URL or text)
|
|
78
|
+
* @param requestedBy - The user ID who requested the search
|
|
79
|
+
* @returns A SearchResult containing tracks and optional playlist information
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Search by URL
|
|
83
|
+
* const result = await plugin.search("https://soundcloud.com/artist/track", "user123");
|
|
84
|
+
*
|
|
85
|
+
* // Search by text
|
|
86
|
+
* const searchResult = await plugin.search("chill music", "user123");
|
|
87
|
+
* console.log(searchResult.tracks); // Array of Track objects
|
|
88
|
+
*/
|
|
11
89
|
search(query: string, requestedBy: string): Promise<SearchResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves the audio stream for a SoundCloud track.
|
|
92
|
+
*
|
|
93
|
+
* This method downloads the audio stream from SoundCloud using the track's URL.
|
|
94
|
+
* It handles the SoundCloud-specific download process and returns the stream
|
|
95
|
+
* in a format compatible with the player.
|
|
96
|
+
*
|
|
97
|
+
* @param track - The Track object to get the stream for
|
|
98
|
+
* @returns A StreamInfo object containing the audio stream and metadata
|
|
99
|
+
* @throws {Error} If the track URL is invalid or stream download fails
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* const track = { id: "123", title: "Track Title", url: "https://soundcloud.com/artist/track", ... };
|
|
103
|
+
* const streamInfo = await plugin.getStream(track);
|
|
104
|
+
* console.log(streamInfo.type); // "arbitrary"
|
|
105
|
+
* console.log(streamInfo.stream); // Readable stream
|
|
106
|
+
*/
|
|
12
107
|
getStream(track: Track): Promise<StreamInfo>;
|
|
108
|
+
/**
|
|
109
|
+
* Gets related tracks for a given SoundCloud track.
|
|
110
|
+
*
|
|
111
|
+
* This method fetches related tracks from SoundCloud's recommendation system
|
|
112
|
+
* based on the provided track URL or ID. It can filter out tracks that are
|
|
113
|
+
* already in the history to avoid duplicates.
|
|
114
|
+
*
|
|
115
|
+
* @param trackURL - The SoundCloud track URL or ID to get related tracks for
|
|
116
|
+
* @param opts - Options for filtering and limiting results
|
|
117
|
+
* @param opts.limit - Maximum number of related tracks to return (default: 1)
|
|
118
|
+
* @param opts.offset - Number of tracks to skip from the beginning (default: 0)
|
|
119
|
+
* @param opts.history - Array of tracks to exclude from results
|
|
120
|
+
* @returns An array of related Track objects
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* const related = await plugin.getRelatedTracks(
|
|
124
|
+
* "https://soundcloud.com/artist/track",
|
|
125
|
+
* { limit: 3, history: [currentTrack] }
|
|
126
|
+
* );
|
|
127
|
+
* console.log(`Found ${related.length} related tracks`);
|
|
128
|
+
*/
|
|
13
129
|
getRelatedTracks(trackURL: string | number, opts?: {
|
|
14
130
|
limit?: number;
|
|
15
131
|
offset?: number;
|
|
16
132
|
history?: Track[];
|
|
17
133
|
}): Promise<Track[]>;
|
|
134
|
+
/**
|
|
135
|
+
* Provides a fallback stream by searching for the track title.
|
|
136
|
+
*
|
|
137
|
+
* This method is used when the primary stream extraction fails. It performs
|
|
138
|
+
* a search using the track's title and attempts to get a stream from the
|
|
139
|
+
* first search result.
|
|
140
|
+
*
|
|
141
|
+
* @param track - The Track object to get a fallback stream for
|
|
142
|
+
* @returns A StreamInfo object containing the fallback audio stream
|
|
143
|
+
* @throws {Error} If no fallback track is found or stream extraction fails
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* try {
|
|
147
|
+
* const stream = await plugin.getStream(track);
|
|
148
|
+
* } catch (error) {
|
|
149
|
+
* // Try fallback
|
|
150
|
+
* const fallbackStream = await plugin.getFallback(track);
|
|
151
|
+
* }
|
|
152
|
+
*/
|
|
18
153
|
getFallback(track: Track): Promise<StreamInfo>;
|
|
154
|
+
/**
|
|
155
|
+
* Extracts tracks from a SoundCloud playlist URL.
|
|
156
|
+
*
|
|
157
|
+
* @param url - The SoundCloud playlist URL
|
|
158
|
+
* @param requestedBy - The user ID who requested the extraction
|
|
159
|
+
* @returns An array of Track objects from the playlist
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* const tracks = await plugin.extractPlaylist(
|
|
163
|
+
* "https://soundcloud.com/artist/sets/playlist-name",
|
|
164
|
+
* "user123"
|
|
165
|
+
* );
|
|
166
|
+
* console.log(`Found ${tracks.length} tracks in playlist`);
|
|
167
|
+
*/
|
|
19
168
|
extractPlaylist(url: string, requestedBy: string): Promise<Track[]>;
|
|
20
169
|
}
|
|
21
170
|
//# sourceMappingURL=SoundCloudPlugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SoundCloudPlugin.d.ts","sourceRoot":"","sources":["../src/SoundCloudPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAgBvE,qBAAa,gBAAiB,SAAQ,UAAU;IAC/C,IAAI,SAAgB;IACpB,OAAO,SAAW;IAClB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAgB;;
|
|
1
|
+
{"version":3,"file":"SoundCloudPlugin.d.ts","sourceRoot":"","sources":["../src/SoundCloudPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAgBvE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC/C,IAAI,SAAgB;IACpB,OAAO,SAAW;IAClB,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,KAAK,CAAgB;IAE7B;;;;;;;;;OASG;;YAMW,IAAI;IAKlB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAgBjC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI9B;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAgFvE;;;;;;;;;;;;;;;;OAgBG;IACG,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;IAmBlD;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,gBAAgB,CACrB,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAA;KAAO,GAC/D,OAAO,CAAC,KAAK,EAAE,CAAC;IAiCnB;;;;;;;;;;;;;;;;;;OAkBG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;IASpD;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAsBzE"}
|
package/dist/SoundCloudPlugin.js
CHANGED
|
@@ -15,7 +15,44 @@ function isValidSoundCloudHost(maybeUrl) {
|
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* A plugin for handling SoundCloud audio content including tracks, playlists, and search functionality.
|
|
20
|
+
*
|
|
21
|
+
* This plugin provides comprehensive support for:
|
|
22
|
+
* - SoundCloud track URLs (soundcloud.com)
|
|
23
|
+
* - SoundCloud playlist URLs
|
|
24
|
+
* - SoundCloud search queries
|
|
25
|
+
* - Audio stream extraction from SoundCloud tracks
|
|
26
|
+
* - Related track recommendations
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
*
|
|
30
|
+
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
31
|
+
*
|
|
32
|
+
* // Add to PlayerManager
|
|
33
|
+
* const manager = new PlayerManager({
|
|
34
|
+
* plugins: [soundcloudPlugin]
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Search for tracks
|
|
38
|
+
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
39
|
+
*
|
|
40
|
+
* // Get audio stream
|
|
41
|
+
* const stream = await soundcloudPlugin.getStream(result.tracks[0]);
|
|
42
|
+
*
|
|
43
|
+
* @since 1.0.0
|
|
44
|
+
*/
|
|
18
45
|
class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new SoundCloudPlugin instance.
|
|
48
|
+
*
|
|
49
|
+
* The plugin will automatically initialize the SoundCloud client for track
|
|
50
|
+
* and playlist operations. Initialization is asynchronous and handled internally.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* const plugin = new SoundCloudPlugin();
|
|
54
|
+
* // Plugin is ready to use after initialization completes
|
|
55
|
+
*/
|
|
19
56
|
constructor() {
|
|
20
57
|
super();
|
|
21
58
|
this.name = "soundcloud";
|
|
@@ -26,6 +63,17 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
26
63
|
this.client = new SoundCloud({ init: false });
|
|
27
64
|
await this.client.init();
|
|
28
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Determines if this plugin can handle the given query.
|
|
68
|
+
*
|
|
69
|
+
* @param query - The search query or URL to check
|
|
70
|
+
* @returns `true` if the plugin can handle the query, `false` otherwise
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* plugin.canHandle("https://soundcloud.com/artist/track"); // true
|
|
74
|
+
* plugin.canHandle("chill music"); // true
|
|
75
|
+
* plugin.canHandle("spotify:track:123"); // false
|
|
76
|
+
*/
|
|
29
77
|
canHandle(query) {
|
|
30
78
|
const q = (query || "").trim().toLowerCase();
|
|
31
79
|
const isUrl = q.startsWith("http://") || q.startsWith("https://");
|
|
@@ -42,9 +90,39 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
42
90
|
// Treat remaining non-URL free text as searchable
|
|
43
91
|
return true;
|
|
44
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Validates if a URL is a valid SoundCloud URL.
|
|
95
|
+
*
|
|
96
|
+
* @param url - The URL to validate
|
|
97
|
+
* @returns `true` if the URL is a valid SoundCloud URL, `false` otherwise
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* plugin.validate("https://soundcloud.com/artist/track"); // true
|
|
101
|
+
* plugin.validate("https://www.soundcloud.com/artist/track"); // true
|
|
102
|
+
* plugin.validate("https://youtube.com/watch?v=123"); // false
|
|
103
|
+
*/
|
|
45
104
|
validate(url) {
|
|
46
105
|
return isValidSoundCloudHost(url);
|
|
47
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Searches for SoundCloud content based on the given query.
|
|
109
|
+
*
|
|
110
|
+
* This method handles both URL-based queries (direct track/playlist links) and
|
|
111
|
+
* text-based search queries. For URLs, it will extract track or playlist information.
|
|
112
|
+
* For text queries, it will perform a SoundCloud search and return up to 10 results.
|
|
113
|
+
*
|
|
114
|
+
* @param query - The search query (URL or text)
|
|
115
|
+
* @param requestedBy - The user ID who requested the search
|
|
116
|
+
* @returns A SearchResult containing tracks and optional playlist information
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* // Search by URL
|
|
120
|
+
* const result = await plugin.search("https://soundcloud.com/artist/track", "user123");
|
|
121
|
+
*
|
|
122
|
+
* // Search by text
|
|
123
|
+
* const searchResult = await plugin.search("chill music", "user123");
|
|
124
|
+
* console.log(searchResult.tracks); // Array of Track objects
|
|
125
|
+
*/
|
|
48
126
|
async search(query, requestedBy) {
|
|
49
127
|
await this.ready;
|
|
50
128
|
// If the query is a URL but not a SoundCloud URL, do not handle it here
|
|
@@ -122,6 +200,23 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
122
200
|
throw new Error(`SoundCloud search failed: ${error?.message}`);
|
|
123
201
|
}
|
|
124
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Retrieves the audio stream for a SoundCloud track.
|
|
205
|
+
*
|
|
206
|
+
* This method downloads the audio stream from SoundCloud using the track's URL.
|
|
207
|
+
* It handles the SoundCloud-specific download process and returns the stream
|
|
208
|
+
* in a format compatible with the player.
|
|
209
|
+
*
|
|
210
|
+
* @param track - The Track object to get the stream for
|
|
211
|
+
* @returns A StreamInfo object containing the audio stream and metadata
|
|
212
|
+
* @throws {Error} If the track URL is invalid or stream download fails
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* const track = { id: "123", title: "Track Title", url: "https://soundcloud.com/artist/track", ... };
|
|
216
|
+
* const streamInfo = await plugin.getStream(track);
|
|
217
|
+
* console.log(streamInfo.type); // "arbitrary"
|
|
218
|
+
* console.log(streamInfo.stream); // Readable stream
|
|
219
|
+
*/
|
|
125
220
|
async getStream(track) {
|
|
126
221
|
await this.ready;
|
|
127
222
|
try {
|
|
@@ -139,6 +234,27 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
139
234
|
throw new Error(`Failed to get SoundCloud stream: ${error.message}`);
|
|
140
235
|
}
|
|
141
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Gets related tracks for a given SoundCloud track.
|
|
239
|
+
*
|
|
240
|
+
* This method fetches related tracks from SoundCloud's recommendation system
|
|
241
|
+
* based on the provided track URL or ID. It can filter out tracks that are
|
|
242
|
+
* already in the history to avoid duplicates.
|
|
243
|
+
*
|
|
244
|
+
* @param trackURL - The SoundCloud track URL or ID to get related tracks for
|
|
245
|
+
* @param opts - Options for filtering and limiting results
|
|
246
|
+
* @param opts.limit - Maximum number of related tracks to return (default: 1)
|
|
247
|
+
* @param opts.offset - Number of tracks to skip from the beginning (default: 0)
|
|
248
|
+
* @param opts.history - Array of tracks to exclude from results
|
|
249
|
+
* @returns An array of related Track objects
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* const related = await plugin.getRelatedTracks(
|
|
253
|
+
* "https://soundcloud.com/artist/track",
|
|
254
|
+
* { limit: 3, history: [currentTrack] }
|
|
255
|
+
* );
|
|
256
|
+
* console.log(`Found ${related.length} related tracks`);
|
|
257
|
+
*/
|
|
142
258
|
async getRelatedTracks(trackURL, opts = {}) {
|
|
143
259
|
await this.ready;
|
|
144
260
|
try {
|
|
@@ -169,6 +285,25 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
169
285
|
return [];
|
|
170
286
|
}
|
|
171
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Provides a fallback stream by searching for the track title.
|
|
290
|
+
*
|
|
291
|
+
* This method is used when the primary stream extraction fails. It performs
|
|
292
|
+
* a search using the track's title and attempts to get a stream from the
|
|
293
|
+
* first search result.
|
|
294
|
+
*
|
|
295
|
+
* @param track - The Track object to get a fallback stream for
|
|
296
|
+
* @returns A StreamInfo object containing the fallback audio stream
|
|
297
|
+
* @throws {Error} If no fallback track is found or stream extraction fails
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* try {
|
|
301
|
+
* const stream = await plugin.getStream(track);
|
|
302
|
+
* } catch (error) {
|
|
303
|
+
* // Try fallback
|
|
304
|
+
* const fallbackStream = await plugin.getFallback(track);
|
|
305
|
+
* }
|
|
306
|
+
*/
|
|
172
307
|
async getFallback(track) {
|
|
173
308
|
const trackfall = await this.search(track.title, track.requestedBy);
|
|
174
309
|
const fallbackTrack = trackfall.tracks?.[0];
|
|
@@ -177,6 +312,20 @@ class SoundCloudPlugin extends ziplayer_1.BasePlugin {
|
|
|
177
312
|
}
|
|
178
313
|
return await this.getStream(fallbackTrack);
|
|
179
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Extracts tracks from a SoundCloud playlist URL.
|
|
317
|
+
*
|
|
318
|
+
* @param url - The SoundCloud playlist URL
|
|
319
|
+
* @param requestedBy - The user ID who requested the extraction
|
|
320
|
+
* @returns An array of Track objects from the playlist
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* const tracks = await plugin.extractPlaylist(
|
|
324
|
+
* "https://soundcloud.com/artist/sets/playlist-name",
|
|
325
|
+
* "user123"
|
|
326
|
+
* );
|
|
327
|
+
* console.log(`Found ${tracks.length} tracks in playlist`);
|
|
328
|
+
*/
|
|
180
329
|
async extractPlaylist(url, requestedBy) {
|
|
181
330
|
await this.ready;
|
|
182
331
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SoundCloudPlugin.js","sourceRoot":"","sources":["../src/SoundCloudPlugin.ts"],"names":[],"mappings":";;;AAAA,uCAAuE;AAEvE,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC1C,6BAA0B;AAE1B,MAAM,wBAAwB,GAAG,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAE9F,SAAS,qBAAqB,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,IAAI,SAAG,CAAC,QAAQ,CAAC,CAAC;QACjC,OAAO,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACR,6CAA6C;QAC7C,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC;AACD,MAAa,gBAAiB,SAAQ,qBAAU;IAM/C;QACC,KAAK,EAAE,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Q,EAAE;gBACnB,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,GAAG,EAAE,CAAC,CAAC,aAAa;gBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,SAAS,EAAE,CAAC,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW;gBAChD,WAAW;gBACX,MAAM,EAAE,IAAI,CAAC,IAAI;gBACjB,QAAQ,EAAE;oBACT,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ;oBACxB,KAAK,EAAE,CAAC,CAAC,cAAc;oBACvB,QAAQ,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE;iBACjC;aACD,CAAC,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,EAAE,CAAC;QACX,CAAC;IACF,CAAC;CACD;AApUD,4CAoUC"}
|
package/dist/SpotifyPlugin.d.ts
CHANGED
|
@@ -1,19 +1,141 @@
|
|
|
1
1
|
import { BasePlugin, Track, SearchResult, StreamInfo } from "ziplayer";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
3
|
+
* A minimal Spotify plugin for metadata extraction and display purposes.
|
|
4
|
+
*
|
|
5
|
+
* This plugin provides support for:
|
|
6
|
+
* - Spotify track URLs/URIs (spotify:track:...)
|
|
7
|
+
* - Spotify playlist URLs/URIs (spotify:playlist:...)
|
|
8
|
+
* - Spotify album URLs/URIs (spotify:album:...)
|
|
9
|
+
* - Metadata extraction using Spotify's public oEmbed endpoint
|
|
10
|
+
*
|
|
11
|
+
* **Important Notes:**
|
|
12
|
+
* - This plugin does NOT provide audio streams (player is expected to redirect/fallback upstream)
|
|
13
|
+
* - This plugin does NOT expand playlists/albums (no SDK; oEmbed doesn't enumerate items)
|
|
14
|
+
* - This plugin only provides display metadata for Spotify content
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
*
|
|
18
|
+
* const spotifyPlugin = new SpotifyPlugin();
|
|
19
|
+
*
|
|
20
|
+
* // Add to PlayerManager
|
|
21
|
+
* const manager = new PlayerManager({
|
|
22
|
+
* plugins: [spotifyPlugin]
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Get metadata for a Spotify track
|
|
26
|
+
* const result = await spotifyPlugin.search("spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "user123");
|
|
27
|
+
* console.log(result.tracks[0].metadata); // Contains Spotify metadata
|
|
28
|
+
*
|
|
29
|
+
*
|
|
30
|
+
* @since 1.1.0
|
|
8
31
|
*/
|
|
9
32
|
export declare class SpotifyPlugin extends BasePlugin {
|
|
10
33
|
name: string;
|
|
11
34
|
version: string;
|
|
35
|
+
/**
|
|
36
|
+
* Determines if this plugin can handle the given query.
|
|
37
|
+
*
|
|
38
|
+
* @param query - The search query or URL to check
|
|
39
|
+
* @returns `true` if the query is a Spotify URL/URI, `false` otherwise
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
*
|
|
43
|
+
* plugin.canHandle("spotify:track:4iV5W9uYEdYUVa79Axb7Rh"); // true
|
|
44
|
+
* plugin.canHandle("https://open.spotify.com/track/4iV5W9uYEdYUVa79Axb7Rh"); // true
|
|
45
|
+
* plugin.canHandle("youtube.com/watch?v=123"); // false
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
12
48
|
canHandle(query: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Validates if a URL/URI is a valid Spotify URL/URI.
|
|
51
|
+
*
|
|
52
|
+
* @param url - The URL/URI to validate
|
|
53
|
+
* @returns `true` if the URL/URI is a valid Spotify URL/URI, `false` otherwise
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
*
|
|
57
|
+
* plugin.validate("spotify:track:4iV5W9uYEdYUVa79Axb7Rh"); // true
|
|
58
|
+
* plugin.validate("https://open.spotify.com/track/4iV5W9uYEdYUVa79Axb7Rh"); // true
|
|
59
|
+
* plugin.validate("https://youtube.com/watch?v=123"); // false
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
13
62
|
validate(url: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Extracts metadata from Spotify URLs/URIs using the oEmbed API.
|
|
65
|
+
*
|
|
66
|
+
* This method handles Spotify track, playlist, and album URLs/URIs by fetching
|
|
67
|
+
* display metadata from Spotify's public oEmbed endpoint. It does not provide
|
|
68
|
+
* audio streams or expand playlists/albums.
|
|
69
|
+
*
|
|
70
|
+
* @param query - The Spotify URL/URI to extract metadata from
|
|
71
|
+
* @param requestedBy - The user ID who requested the extraction
|
|
72
|
+
* @returns A SearchResult containing a single track with metadata (no audio stream)
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
*
|
|
76
|
+
* // Extract track metadata
|
|
77
|
+
* const result = await plugin.search("spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "user123");
|
|
78
|
+
* console.log(result.tracks[0].metadata); // Contains Spotify metadata
|
|
79
|
+
*
|
|
80
|
+
* // Extract playlist metadata
|
|
81
|
+
* const playlistResult = await plugin.search("https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M", "user123");
|
|
82
|
+
* console.log(playlistResult.tracks[0].metadata.kind); // "playlist"
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
14
85
|
search(query: string, requestedBy: string): Promise<SearchResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Extracts tracks from a Spotify playlist URL.
|
|
88
|
+
*
|
|
89
|
+
* **Note:** This method is not implemented as this plugin does not support
|
|
90
|
+
* playlist expansion. It always returns an empty array.
|
|
91
|
+
*
|
|
92
|
+
* @param _input - The Spotify playlist URL (unused)
|
|
93
|
+
* @param _requestedBy - The user ID who requested the extraction (unused)
|
|
94
|
+
* @returns An empty array (playlist expansion not supported)
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
*
|
|
98
|
+
* const tracks = await plugin.extractPlaylist("spotify:playlist:123", "user123");
|
|
99
|
+
* console.log(tracks); // [] - empty array
|
|
100
|
+
*
|
|
101
|
+
*/
|
|
15
102
|
extractPlaylist(_input: string, _requestedBy: string): Promise<Track[]>;
|
|
103
|
+
/**
|
|
104
|
+
* Extracts tracks from a Spotify album URL.
|
|
105
|
+
*
|
|
106
|
+
* **Note:** This method is not implemented as this plugin does not support
|
|
107
|
+
* album expansion. It always returns an empty array.
|
|
108
|
+
*
|
|
109
|
+
* @param _input - The Spotify album URL (unused)
|
|
110
|
+
* @param _requestedBy - The user ID who requested the extraction (unused)
|
|
111
|
+
* @returns An empty array (album expansion not supported)
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
*
|
|
115
|
+
* const tracks = await plugin.extractAlbum("spotify:album:123", "user123");
|
|
116
|
+
* console.log(tracks); // [] - empty array
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
16
119
|
extractAlbum(_input: string, _requestedBy: string): Promise<Track[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Attempts to get an audio stream for a Spotify track.
|
|
122
|
+
*
|
|
123
|
+
* **Note:** This method always throws an error as this plugin does not support
|
|
124
|
+
* audio streaming. The player is expected to redirect to other plugins or
|
|
125
|
+
* use fallback mechanisms for actual audio playback.
|
|
126
|
+
*
|
|
127
|
+
* @param _track - The Track object (unused)
|
|
128
|
+
* @throws {Error} Always throws "Spotify streaming is not supported by this plugin"
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
*
|
|
132
|
+
* try {
|
|
133
|
+
* const stream = await plugin.getStream(track);
|
|
134
|
+
* } catch (error) {
|
|
135
|
+
* console.log(error.message); // "Spotify streaming is not supported by this plugin"
|
|
136
|
+
* }
|
|
137
|
+
*
|
|
138
|
+
*/
|
|
17
139
|
getStream(_track: Track): Promise<StreamInfo>;
|
|
18
140
|
private identifyKind;
|
|
19
141
|
private extractId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpotifyPlugin.d.ts","sourceRoot":"","sources":["../src/SpotifyPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"SpotifyPlugin.d.ts","sourceRoot":"","sources":["../src/SpotifyPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,aAAc,SAAQ,UAAU;IAC5C,IAAI,SAAa;IACjB,OAAO,SAAW;IAElB;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAWjC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAU9B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAyBvE;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAI7E;;;;;;;;;;;;;;;OAeG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAI1E;;;;;;;;;;;;;;;;;;OAkBG;IACG,SAAS,CAAC,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC;IAInD,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,SAAS;YAeH,sBAAsB;YA0BtB,eAAe;IA0B7B,OAAO,CAAC,UAAU;YAeJ,WAAW;CAgBzB"}
|