@ziplayer/plugin 0.1.1 → 0.1.33
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/TTSPlugin.js +2 -0
- package/dist/TTSPlugin.js.map +1 -1
- package/dist/YTSRPlugin.d.ts.map +1 -1
- package/dist/YTSRPlugin.js +19 -1
- package/dist/YTSRPlugin.js.map +1 -1
- package/package.json +42 -42
- package/src/SoundCloudPlugin.ts +368 -368
- package/src/TTSPlugin.ts +1 -1
- package/src/YTSRPlugin.ts +20 -1
- package/src/index.ts +103 -103
- package/tsconfig.json +23 -23
package/dist/TTSPlugin.js
CHANGED
|
@@ -161,6 +161,8 @@ class TTSPlugin extends ziplayer_1.BasePlugin {
|
|
|
161
161
|
*/
|
|
162
162
|
async getStream(track) {
|
|
163
163
|
const cfg = this.extractConfig(track);
|
|
164
|
+
if (track.source !== this.name)
|
|
165
|
+
return { stream: null, type: "arbitrary" };
|
|
164
166
|
if (this.opts.createStream && typeof this.opts.createStream === "function") {
|
|
165
167
|
const out = await this.opts.createStream(cfg.text, { lang: cfg.lang, slow: cfg.slow, track });
|
|
166
168
|
let type;
|
package/dist/TTSPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TTSPlugin.js","sourceRoot":"","sources":["../src/TTSPlugin.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAuE;AACvE,mCAAkC;AAClC,wCAA0C;AAC1C,kDAA0B;AAgD1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAa,SAAU,SAAQ,qBAAU;IAKxC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,YAAY,IAAuB;QAClC,KAAK,EAAE,CAAC;QA/BT,SAAI,GAAG,KAAK,CAAC;QACb,YAAO,GAAG,OAAO,CAAC;QA+BjB,IAAI,CAAC,IAAI,GAAG;YACX,WAAW,EAAE,IAAI,EAAE,WAAW,IAAI,IAA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AMG;IACH,OAAO,CAAC,qBAAqB;IAsB7B;;;;;;;OAOG;YACW,yBAAyB;IA0CvC;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAKnB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IASrB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAwBtB;;;;;OAKG;IACG,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;IAI3C;;;;;;;;;;;;;;;;OAgBG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAIvG;;;;;;;;;;;;;;;;OAgBG;IACG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAA;KAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAwC7H;;;;;OAKG;IACG,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC;CAG7C"}
|
package/dist/YTSRPlugin.js
CHANGED
|
@@ -292,11 +292,29 @@ class YTSRPlugin extends ziplayer_1.BasePlugin {
|
|
|
292
292
|
* @returns Track object
|
|
293
293
|
*/
|
|
294
294
|
buildTrackFromVideo(video, requestedBy) {
|
|
295
|
+
// Xử lý duration một cách an toàn
|
|
296
|
+
let duration = 0;
|
|
297
|
+
if (video.duration) {
|
|
298
|
+
if (typeof video.duration === "number") {
|
|
299
|
+
duration = video.duration;
|
|
300
|
+
}
|
|
301
|
+
else if (typeof video.duration === "object" && video.duration !== null) {
|
|
302
|
+
// Nếu duration là object, thử lấy seconds
|
|
303
|
+
duration = video.duration?.seconds || video.duration?.totalSeconds || 0;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
// youtube-sr trả về duration theo milliseconds, chuyển thành seconds
|
|
307
|
+
if (duration > 0) {
|
|
308
|
+
// Nếu duration lớn hơn 1000, có thể là milliseconds
|
|
309
|
+
if (duration > 1000) {
|
|
310
|
+
duration = Math.floor(duration / 1000);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
295
313
|
return {
|
|
296
314
|
id: video.id,
|
|
297
315
|
title: video.title,
|
|
298
316
|
url: video.url,
|
|
299
|
-
duration:
|
|
317
|
+
duration: Math.max(0, duration), // Đảm bảo duration không âm
|
|
300
318
|
thumbnail: video.thumbnail?.url || video.thumbnails?.[0]?.url,
|
|
301
319
|
requestedBy,
|
|
302
320
|
source: this.name,
|
package/dist/YTSRPlugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTSRPlugin.js","sourceRoot":"","sources":["../src/YTSRPlugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA2D;AAC3D,yDAA+D;AAE/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,UAAW,SAAQ,qBAAU;IAIzC;;;;;;;;;OASG;IACH;QACC,KAAK,EAAE,CAAC;QAdT,SAAI,GAAG,MAAM,CAAC;QACd,YAAO,GAAG,OAAO,CAAC;IAclB,CAAC;IAED;;;;;;;;;;OAUG;IACH,SAAS,CAAC,KAAa;QACtB,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAE7C,yDAAyD;QACzD,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/D,IAAI,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAAE,OAAO,KAAK,CAAC;QAC7E,IAAI,CAAC,CAA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"0.1.
|
|
4
|
-
"description": "A modular Discord voice player with plugin system",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"ZiPlayer",
|
|
7
|
-
"@ziplayer/plugin",
|
|
8
|
-
"discord",
|
|
9
|
-
"music",
|
|
10
|
-
"player",
|
|
11
|
-
"voice"
|
|
12
|
-
],
|
|
13
|
-
"homepage": "https://player.ziji.world",
|
|
14
|
-
"bugs": {
|
|
15
|
-
"url": "https://github.com/ZiProject/ZiPlayer/issues"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "git+https://github.com/ZiProject/ZiPlayer.git"
|
|
20
|
-
},
|
|
21
|
-
"license": "MIT",
|
|
22
|
-
"author": "Ziji",
|
|
23
|
-
"main": "dist/index.js",
|
|
24
|
-
"types": "dist/index.d.ts",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc",
|
|
27
|
-
"dev": "tsc --watch",
|
|
28
|
-
"prepare": "npm run build"
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@zibot/scdl": "^0.0.5",
|
|
32
|
-
"@zibot/zitts": "^0.0.3",
|
|
33
|
-
"axios": "^1.12.2",
|
|
34
|
-
"youtube-sr": "^4.3.4",
|
|
35
|
-
"youtubei.js": "^15.0.1",
|
|
36
|
-
"ziplayer": "^0.
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@types/node": "^20.0.0",
|
|
40
|
-
"typescript": "^5.0.0"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@ziplayer/plugin",
|
|
3
|
+
"version": "0.1.33",
|
|
4
|
+
"description": "A modular Discord voice player with plugin system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ZiPlayer",
|
|
7
|
+
"@ziplayer/plugin",
|
|
8
|
+
"discord",
|
|
9
|
+
"music",
|
|
10
|
+
"player",
|
|
11
|
+
"voice"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://player.ziji.world",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ZiProject/ZiPlayer/issues"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/ZiProject/ZiPlayer.git"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Ziji",
|
|
23
|
+
"main": "dist/index.js",
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc",
|
|
27
|
+
"dev": "tsc --watch",
|
|
28
|
+
"prepare": "npm run build"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@zibot/scdl": "^0.0.5",
|
|
32
|
+
"@zibot/zitts": "^0.0.3",
|
|
33
|
+
"axios": "^1.12.2",
|
|
34
|
+
"youtube-sr": "^4.3.4",
|
|
35
|
+
"youtubei.js": "^15.0.1",
|
|
36
|
+
"ziplayer": "^0.1.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^20.0.0",
|
|
40
|
+
"typescript": "^5.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/SoundCloudPlugin.ts
CHANGED
|
@@ -1,368 +1,368 @@
|
|
|
1
|
-
import { BasePlugin, Track, SearchResult, StreamInfo } from "ziplayer";
|
|
2
|
-
|
|
3
|
-
const SoundCloud = require("@zibot/scdl");
|
|
4
|
-
import { URL } from "url";
|
|
5
|
-
|
|
6
|
-
const ALLOWED_SOUNDCLOUD_HOSTS = ["soundcloud.com", "www.soundcloud.com", "m.soundcloud.com"];
|
|
7
|
-
|
|
8
|
-
function isValidSoundCloudHost(maybeUrl: string): boolean {
|
|
9
|
-
try {
|
|
10
|
-
const parsed = new URL(maybeUrl);
|
|
11
|
-
return ALLOWED_SOUNDCLOUD_HOSTS.includes(parsed.hostname);
|
|
12
|
-
} catch {
|
|
13
|
-
// Not a valid URL, not handled as host-based
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A plugin for handling SoundCloud audio content including tracks, playlists, and search functionality.
|
|
19
|
-
*
|
|
20
|
-
* This plugin provides comprehensive support for:
|
|
21
|
-
* - SoundCloud track URLs (soundcloud.com)
|
|
22
|
-
* - SoundCloud playlist URLs
|
|
23
|
-
* - SoundCloud search queries
|
|
24
|
-
* - Audio stream extraction from SoundCloud tracks
|
|
25
|
-
* - Related track recommendations
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
*
|
|
29
|
-
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
30
|
-
*
|
|
31
|
-
* // Add to PlayerManager
|
|
32
|
-
* const manager = new PlayerManager({
|
|
33
|
-
* plugins: [soundcloudPlugin]
|
|
34
|
-
* });
|
|
35
|
-
*
|
|
36
|
-
* // Search for tracks
|
|
37
|
-
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
38
|
-
*
|
|
39
|
-
* // Get audio stream
|
|
40
|
-
* const stream = await soundcloudPlugin.getStream(result.tracks[0]);
|
|
41
|
-
*
|
|
42
|
-
* @since 1.0.0
|
|
43
|
-
*/
|
|
44
|
-
export class SoundCloudPlugin extends BasePlugin {
|
|
45
|
-
name = "soundcloud";
|
|
46
|
-
version = "1.0.0";
|
|
47
|
-
private client: any;
|
|
48
|
-
private ready: Promise<void>;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Creates a new SoundCloudPlugin instance.
|
|
52
|
-
*
|
|
53
|
-
* The plugin will automatically initialize the SoundCloud client for track
|
|
54
|
-
* and playlist operations. Initialization is asynchronous and handled internally.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* const plugin = new SoundCloudPlugin();
|
|
58
|
-
* // Plugin is ready to use after initialization completes
|
|
59
|
-
*/
|
|
60
|
-
constructor() {
|
|
61
|
-
super();
|
|
62
|
-
this.ready = this.init();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
private async init(): Promise<void> {
|
|
66
|
-
this.client = new SoundCloud({ init: false });
|
|
67
|
-
await this.client.init();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Determines if this plugin can handle the given query.
|
|
72
|
-
*
|
|
73
|
-
* @param query - The search query or URL to check
|
|
74
|
-
* @returns `true` if the plugin can handle the query, `false` otherwise
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* plugin.canHandle("https://soundcloud.com/artist/track"); // true
|
|
78
|
-
* plugin.canHandle("chill music"); // true
|
|
79
|
-
* plugin.canHandle("spotify:track:123"); // false
|
|
80
|
-
*/
|
|
81
|
-
canHandle(query: string): boolean {
|
|
82
|
-
const q = (query || "").trim().toLowerCase();
|
|
83
|
-
const isUrl = q.startsWith("http://") || q.startsWith("https://");
|
|
84
|
-
if (isUrl) {
|
|
85
|
-
return isValidSoundCloudHost(query);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Avoid intercepting explicit patterns for other extractors
|
|
89
|
-
if (q.startsWith("tts:") || q.startsWith("say ")) return false;
|
|
90
|
-
if (q.startsWith("spotify:") || q.includes("open.spotify.com")) return false;
|
|
91
|
-
if (q.includes("youtube")) return false;
|
|
92
|
-
|
|
93
|
-
// Treat remaining non-URL free text as searchable
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Validates if a URL is a valid SoundCloud URL.
|
|
99
|
-
*
|
|
100
|
-
* @param url - The URL to validate
|
|
101
|
-
* @returns `true` if the URL is a valid SoundCloud URL, `false` otherwise
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* plugin.validate("https://soundcloud.com/artist/track"); // true
|
|
105
|
-
* plugin.validate("https://www.soundcloud.com/artist/track"); // true
|
|
106
|
-
* plugin.validate("https://youtube.com/watch?v=123"); // false
|
|
107
|
-
*/
|
|
108
|
-
validate(url: string): boolean {
|
|
109
|
-
return isValidSoundCloudHost(url);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Searches for SoundCloud content based on the given query.
|
|
114
|
-
*
|
|
115
|
-
* This method handles both URL-based queries (direct track/playlist links) and
|
|
116
|
-
* text-based search queries. For URLs, it will extract track or playlist information.
|
|
117
|
-
* For text queries, it will perform a SoundCloud search and return up to 10 results.
|
|
118
|
-
*
|
|
119
|
-
* @param query - The search query (URL or text)
|
|
120
|
-
* @param requestedBy - The user ID who requested the search
|
|
121
|
-
* @returns A SearchResult containing tracks and optional playlist information
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
124
|
-
* // Search by URL
|
|
125
|
-
* const result = await plugin.search("https://soundcloud.com/artist/track", "user123");
|
|
126
|
-
*
|
|
127
|
-
* // Search by text
|
|
128
|
-
* const searchResult = await plugin.search("chill music", "user123");
|
|
129
|
-
* console.log(searchResult.tracks); // Array of Track objects
|
|
130
|
-
*/
|
|
131
|
-
async search(query: string, requestedBy: string): Promise<SearchResult> {
|
|
132
|
-
await this.ready;
|
|
133
|
-
|
|
134
|
-
// If the query is a URL but not a SoundCloud URL, do not handle it here
|
|
135
|
-
// This prevents hijacking e.g. YouTube/Spotify links as free-text searches.
|
|
136
|
-
try {
|
|
137
|
-
const q = (query || "").trim().toLowerCase();
|
|
138
|
-
const isUrl = q.startsWith("http://") || q.startsWith("https://");
|
|
139
|
-
if (isUrl && !this.validate(query)) {
|
|
140
|
-
return { tracks: [] };
|
|
141
|
-
}
|
|
142
|
-
} catch {}
|
|
143
|
-
|
|
144
|
-
try {
|
|
145
|
-
if (isValidSoundCloudHost(query)) {
|
|
146
|
-
try {
|
|
147
|
-
const info = await this.client.getTrackDetails(query);
|
|
148
|
-
const track: Track = {
|
|
149
|
-
id: info.id.toString(),
|
|
150
|
-
title: info.title,
|
|
151
|
-
url: info.permalink_url || query,
|
|
152
|
-
duration: info.duration,
|
|
153
|
-
thumbnail: info.artwork_url,
|
|
154
|
-
requestedBy,
|
|
155
|
-
source: this.name,
|
|
156
|
-
metadata: {
|
|
157
|
-
author: info.user?.username,
|
|
158
|
-
plays: info.playback_count,
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
return { tracks: [track] };
|
|
162
|
-
} catch {
|
|
163
|
-
const playlist = await this.client.getPlaylistDetails(query);
|
|
164
|
-
const tracks: Track[] = playlist.tracks.map((t: any) => ({
|
|
165
|
-
id: t.id.toString(),
|
|
166
|
-
title: t.title,
|
|
167
|
-
url: t.permalink_url,
|
|
168
|
-
duration: t.duration,
|
|
169
|
-
thumbnail: t.artwork_url || playlist.artwork_url,
|
|
170
|
-
requestedBy,
|
|
171
|
-
source: this.name,
|
|
172
|
-
metadata: {
|
|
173
|
-
author: t.user?.username,
|
|
174
|
-
plays: t.playback_count,
|
|
175
|
-
playlist: playlist.id?.toString(),
|
|
176
|
-
},
|
|
177
|
-
}));
|
|
178
|
-
|
|
179
|
-
return {
|
|
180
|
-
tracks,
|
|
181
|
-
playlist: {
|
|
182
|
-
name: playlist.title,
|
|
183
|
-
url: playlist.permalink_url || query,
|
|
184
|
-
thumbnail: playlist.artwork_url,
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
const results = await this.client.searchTracks({ query, limit: 15 });
|
|
191
|
-
const tracks: Track[] = results.slice(0, 10).map((track: any) => ({
|
|
192
|
-
id: track.id.toString(),
|
|
193
|
-
title: track.title,
|
|
194
|
-
url: track.permalink_url,
|
|
195
|
-
duration: track.duration,
|
|
196
|
-
thumbnail: track.artwork_url,
|
|
197
|
-
requestedBy,
|
|
198
|
-
source: this.name,
|
|
199
|
-
metadata: {
|
|
200
|
-
author: track.user?.username,
|
|
201
|
-
plays: track.playback_count,
|
|
202
|
-
},
|
|
203
|
-
}));
|
|
204
|
-
|
|
205
|
-
return { tracks };
|
|
206
|
-
} catch (error: any) {
|
|
207
|
-
throw new Error(`SoundCloud search failed: ${error?.message}`);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Retrieves the audio stream for a SoundCloud track.
|
|
213
|
-
*
|
|
214
|
-
* This method downloads the audio stream from SoundCloud using the track's URL.
|
|
215
|
-
* It handles the SoundCloud-specific download process and returns the stream
|
|
216
|
-
* in a format compatible with the player.
|
|
217
|
-
*
|
|
218
|
-
* @param track - The Track object to get the stream for
|
|
219
|
-
* @returns A StreamInfo object containing the audio stream and metadata
|
|
220
|
-
* @throws {Error} If the track URL is invalid or stream download fails
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* const track = { id: "123", title: "Track Title", url: "https://soundcloud.com/artist/track", ... };
|
|
224
|
-
* const streamInfo = await plugin.getStream(track);
|
|
225
|
-
* console.log(streamInfo.type); // "arbitrary"
|
|
226
|
-
* console.log(streamInfo.stream); // Readable stream
|
|
227
|
-
*/
|
|
228
|
-
async getStream(track: Track): Promise<StreamInfo> {
|
|
229
|
-
await this.ready;
|
|
230
|
-
|
|
231
|
-
try {
|
|
232
|
-
const stream = await this.client.downloadTrack(track.url);
|
|
233
|
-
if (!stream) {
|
|
234
|
-
throw new Error("SoundCloud download returned null");
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
return {
|
|
238
|
-
stream,
|
|
239
|
-
type: "arbitrary",
|
|
240
|
-
metadata: track.metadata,
|
|
241
|
-
};
|
|
242
|
-
} catch (error: any) {
|
|
243
|
-
throw new Error(`Failed to get SoundCloud stream: ${error.message}`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Gets related tracks for a given SoundCloud track.
|
|
249
|
-
*
|
|
250
|
-
* This method fetches related tracks from SoundCloud's recommendation system
|
|
251
|
-
* based on the provided track URL or ID. It can filter out tracks that are
|
|
252
|
-
* already in the history to avoid duplicates.
|
|
253
|
-
*
|
|
254
|
-
* @param trackURL - The SoundCloud track URL or ID to get related tracks for
|
|
255
|
-
* @param opts - Options for filtering and limiting results
|
|
256
|
-
* @param opts.limit - Maximum number of related tracks to return (default: 1)
|
|
257
|
-
* @param opts.offset - Number of tracks to skip from the beginning (default: 0)
|
|
258
|
-
* @param opts.history - Array of tracks to exclude from results
|
|
259
|
-
* @returns An array of related Track objects
|
|
260
|
-
*
|
|
261
|
-
* @example
|
|
262
|
-
* const related = await plugin.getRelatedTracks(
|
|
263
|
-
* "https://soundcloud.com/artist/track",
|
|
264
|
-
* { limit: 3, history: [currentTrack] }
|
|
265
|
-
* );
|
|
266
|
-
* console.log(`Found ${related.length} related tracks`);
|
|
267
|
-
*/
|
|
268
|
-
async getRelatedTracks(
|
|
269
|
-
trackURL: string | number,
|
|
270
|
-
opts: { limit?: number; offset?: number; history?: Track[] } = {},
|
|
271
|
-
): Promise<Track[]> {
|
|
272
|
-
await this.ready;
|
|
273
|
-
try {
|
|
274
|
-
const tracks = await this.client.getRelatedTracks(trackURL, {
|
|
275
|
-
limit: 30,
|
|
276
|
-
filter: "tracks",
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
if (!tracks || !tracks?.length) {
|
|
280
|
-
return [];
|
|
281
|
-
}
|
|
282
|
-
const relatedfilter = tracks.filter((tr: any) => !(opts?.history ?? []).some((t) => t.url === tr.permalink_url));
|
|
283
|
-
|
|
284
|
-
const related = relatedfilter.slice(0, opts.limit || 1);
|
|
285
|
-
|
|
286
|
-
return related.map((t: any) => ({
|
|
287
|
-
id: t.id.toString(),
|
|
288
|
-
title: t.title,
|
|
289
|
-
url: t.permalink_url,
|
|
290
|
-
duration: t.duration,
|
|
291
|
-
thumbnail: t.artwork_url,
|
|
292
|
-
requestedBy: "auto",
|
|
293
|
-
source: this.name,
|
|
294
|
-
metadata: {
|
|
295
|
-
author: t.user?.username,
|
|
296
|
-
plays: t.playback_count,
|
|
297
|
-
},
|
|
298
|
-
}));
|
|
299
|
-
} catch {
|
|
300
|
-
return [];
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Provides a fallback stream by searching for the track title.
|
|
306
|
-
*
|
|
307
|
-
* This method is used when the primary stream extraction fails. It performs
|
|
308
|
-
* a search using the track's title and attempts to get a stream from the
|
|
309
|
-
* first search result.
|
|
310
|
-
*
|
|
311
|
-
* @param track - The Track object to get a fallback stream for
|
|
312
|
-
* @returns A StreamInfo object containing the fallback audio stream
|
|
313
|
-
* @throws {Error} If no fallback track is found or stream extraction fails
|
|
314
|
-
*
|
|
315
|
-
* @example
|
|
316
|
-
* try {
|
|
317
|
-
* const stream = await plugin.getStream(track);
|
|
318
|
-
* } catch (error) {
|
|
319
|
-
* // Try fallback
|
|
320
|
-
* const fallbackStream = await plugin.getFallback(track);
|
|
321
|
-
* }
|
|
322
|
-
*/
|
|
323
|
-
async getFallback(track: Track): Promise<StreamInfo> {
|
|
324
|
-
const trackfall = await this.search(track.title, track.requestedBy);
|
|
325
|
-
const fallbackTrack = trackfall.tracks?.[0];
|
|
326
|
-
if (!fallbackTrack) {
|
|
327
|
-
throw new Error(`No fallback track found for ${track.title}`);
|
|
328
|
-
}
|
|
329
|
-
return await this.getStream(fallbackTrack);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Extracts tracks from a SoundCloud playlist URL.
|
|
334
|
-
*
|
|
335
|
-
* @param url - The SoundCloud playlist URL
|
|
336
|
-
* @param requestedBy - The user ID who requested the extraction
|
|
337
|
-
* @returns An array of Track objects from the playlist
|
|
338
|
-
*
|
|
339
|
-
* @example
|
|
340
|
-
* const tracks = await plugin.extractPlaylist(
|
|
341
|
-
* "https://soundcloud.com/artist/sets/playlist-name",
|
|
342
|
-
* "user123"
|
|
343
|
-
* );
|
|
344
|
-
* console.log(`Found ${tracks.length} tracks in playlist`);
|
|
345
|
-
*/
|
|
346
|
-
async extractPlaylist(url: string, requestedBy: string): Promise<Track[]> {
|
|
347
|
-
await this.ready;
|
|
348
|
-
try {
|
|
349
|
-
const playlist = await this.client.getPlaylistDetails(url);
|
|
350
|
-
return playlist.tracks.map((t: any) => ({
|
|
351
|
-
id: t.id.toString(),
|
|
352
|
-
title: t.title,
|
|
353
|
-
url: t.permalink_url,
|
|
354
|
-
duration: t.duration,
|
|
355
|
-
thumbnail: t.artwork_url || playlist.artwork_url,
|
|
356
|
-
requestedBy,
|
|
357
|
-
source: this.name,
|
|
358
|
-
metadata: {
|
|
359
|
-
author: t.user?.username,
|
|
360
|
-
plays: t.playback_count,
|
|
361
|
-
playlist: playlist.id?.toString(),
|
|
362
|
-
},
|
|
363
|
-
}));
|
|
364
|
-
} catch {
|
|
365
|
-
return [];
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
1
|
+
import { BasePlugin, Track, SearchResult, StreamInfo } from "ziplayer";
|
|
2
|
+
|
|
3
|
+
const SoundCloud = require("@zibot/scdl");
|
|
4
|
+
import { URL } from "url";
|
|
5
|
+
|
|
6
|
+
const ALLOWED_SOUNDCLOUD_HOSTS = ["soundcloud.com", "www.soundcloud.com", "m.soundcloud.com"];
|
|
7
|
+
|
|
8
|
+
function isValidSoundCloudHost(maybeUrl: string): boolean {
|
|
9
|
+
try {
|
|
10
|
+
const parsed = new URL(maybeUrl);
|
|
11
|
+
return ALLOWED_SOUNDCLOUD_HOSTS.includes(parsed.hostname);
|
|
12
|
+
} catch {
|
|
13
|
+
// Not a valid URL, not handled as host-based
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A plugin for handling SoundCloud audio content including tracks, playlists, and search functionality.
|
|
19
|
+
*
|
|
20
|
+
* This plugin provides comprehensive support for:
|
|
21
|
+
* - SoundCloud track URLs (soundcloud.com)
|
|
22
|
+
* - SoundCloud playlist URLs
|
|
23
|
+
* - SoundCloud search queries
|
|
24
|
+
* - Audio stream extraction from SoundCloud tracks
|
|
25
|
+
* - Related track recommendations
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
*
|
|
29
|
+
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
30
|
+
*
|
|
31
|
+
* // Add to PlayerManager
|
|
32
|
+
* const manager = new PlayerManager({
|
|
33
|
+
* plugins: [soundcloudPlugin]
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Search for tracks
|
|
37
|
+
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
38
|
+
*
|
|
39
|
+
* // Get audio stream
|
|
40
|
+
* const stream = await soundcloudPlugin.getStream(result.tracks[0]);
|
|
41
|
+
*
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
*/
|
|
44
|
+
export class SoundCloudPlugin extends BasePlugin {
|
|
45
|
+
name = "soundcloud";
|
|
46
|
+
version = "1.0.0";
|
|
47
|
+
private client: any;
|
|
48
|
+
private ready: Promise<void>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new SoundCloudPlugin instance.
|
|
52
|
+
*
|
|
53
|
+
* The plugin will automatically initialize the SoundCloud client for track
|
|
54
|
+
* and playlist operations. Initialization is asynchronous and handled internally.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const plugin = new SoundCloudPlugin();
|
|
58
|
+
* // Plugin is ready to use after initialization completes
|
|
59
|
+
*/
|
|
60
|
+
constructor() {
|
|
61
|
+
super();
|
|
62
|
+
this.ready = this.init();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
private async init(): Promise<void> {
|
|
66
|
+
this.client = new SoundCloud({ init: false });
|
|
67
|
+
await this.client.init();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Determines if this plugin can handle the given query.
|
|
72
|
+
*
|
|
73
|
+
* @param query - The search query or URL to check
|
|
74
|
+
* @returns `true` if the plugin can handle the query, `false` otherwise
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* plugin.canHandle("https://soundcloud.com/artist/track"); // true
|
|
78
|
+
* plugin.canHandle("chill music"); // true
|
|
79
|
+
* plugin.canHandle("spotify:track:123"); // false
|
|
80
|
+
*/
|
|
81
|
+
canHandle(query: string): boolean {
|
|
82
|
+
const q = (query || "").trim().toLowerCase();
|
|
83
|
+
const isUrl = q.startsWith("http://") || q.startsWith("https://");
|
|
84
|
+
if (isUrl) {
|
|
85
|
+
return isValidSoundCloudHost(query);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Avoid intercepting explicit patterns for other extractors
|
|
89
|
+
if (q.startsWith("tts:") || q.startsWith("say ")) return false;
|
|
90
|
+
if (q.startsWith("spotify:") || q.includes("open.spotify.com")) return false;
|
|
91
|
+
if (q.includes("youtube")) return false;
|
|
92
|
+
|
|
93
|
+
// Treat remaining non-URL free text as searchable
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Validates if a URL is a valid SoundCloud URL.
|
|
99
|
+
*
|
|
100
|
+
* @param url - The URL to validate
|
|
101
|
+
* @returns `true` if the URL is a valid SoundCloud URL, `false` otherwise
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* plugin.validate("https://soundcloud.com/artist/track"); // true
|
|
105
|
+
* plugin.validate("https://www.soundcloud.com/artist/track"); // true
|
|
106
|
+
* plugin.validate("https://youtube.com/watch?v=123"); // false
|
|
107
|
+
*/
|
|
108
|
+
validate(url: string): boolean {
|
|
109
|
+
return isValidSoundCloudHost(url);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Searches for SoundCloud content based on the given query.
|
|
114
|
+
*
|
|
115
|
+
* This method handles both URL-based queries (direct track/playlist links) and
|
|
116
|
+
* text-based search queries. For URLs, it will extract track or playlist information.
|
|
117
|
+
* For text queries, it will perform a SoundCloud search and return up to 10 results.
|
|
118
|
+
*
|
|
119
|
+
* @param query - The search query (URL or text)
|
|
120
|
+
* @param requestedBy - The user ID who requested the search
|
|
121
|
+
* @returns A SearchResult containing tracks and optional playlist information
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* // Search by URL
|
|
125
|
+
* const result = await plugin.search("https://soundcloud.com/artist/track", "user123");
|
|
126
|
+
*
|
|
127
|
+
* // Search by text
|
|
128
|
+
* const searchResult = await plugin.search("chill music", "user123");
|
|
129
|
+
* console.log(searchResult.tracks); // Array of Track objects
|
|
130
|
+
*/
|
|
131
|
+
async search(query: string, requestedBy: string): Promise<SearchResult> {
|
|
132
|
+
await this.ready;
|
|
133
|
+
|
|
134
|
+
// If the query is a URL but not a SoundCloud URL, do not handle it here
|
|
135
|
+
// This prevents hijacking e.g. YouTube/Spotify links as free-text searches.
|
|
136
|
+
try {
|
|
137
|
+
const q = (query || "").trim().toLowerCase();
|
|
138
|
+
const isUrl = q.startsWith("http://") || q.startsWith("https://");
|
|
139
|
+
if (isUrl && !this.validate(query)) {
|
|
140
|
+
return { tracks: [] };
|
|
141
|
+
}
|
|
142
|
+
} catch {}
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
if (isValidSoundCloudHost(query)) {
|
|
146
|
+
try {
|
|
147
|
+
const info = await this.client.getTrackDetails(query);
|
|
148
|
+
const track: Track = {
|
|
149
|
+
id: info.id.toString(),
|
|
150
|
+
title: info.title,
|
|
151
|
+
url: info.permalink_url || query,
|
|
152
|
+
duration: info.duration,
|
|
153
|
+
thumbnail: info.artwork_url,
|
|
154
|
+
requestedBy,
|
|
155
|
+
source: this.name,
|
|
156
|
+
metadata: {
|
|
157
|
+
author: info.user?.username,
|
|
158
|
+
plays: info.playback_count,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
return { tracks: [track] };
|
|
162
|
+
} catch {
|
|
163
|
+
const playlist = await this.client.getPlaylistDetails(query);
|
|
164
|
+
const tracks: Track[] = playlist.tracks.map((t: any) => ({
|
|
165
|
+
id: t.id.toString(),
|
|
166
|
+
title: t.title,
|
|
167
|
+
url: t.permalink_url,
|
|
168
|
+
duration: t.duration,
|
|
169
|
+
thumbnail: t.artwork_url || playlist.artwork_url,
|
|
170
|
+
requestedBy,
|
|
171
|
+
source: this.name,
|
|
172
|
+
metadata: {
|
|
173
|
+
author: t.user?.username,
|
|
174
|
+
plays: t.playback_count,
|
|
175
|
+
playlist: playlist.id?.toString(),
|
|
176
|
+
},
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
tracks,
|
|
181
|
+
playlist: {
|
|
182
|
+
name: playlist.title,
|
|
183
|
+
url: playlist.permalink_url || query,
|
|
184
|
+
thumbnail: playlist.artwork_url,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const results = await this.client.searchTracks({ query, limit: 15 });
|
|
191
|
+
const tracks: Track[] = results.slice(0, 10).map((track: any) => ({
|
|
192
|
+
id: track.id.toString(),
|
|
193
|
+
title: track.title,
|
|
194
|
+
url: track.permalink_url,
|
|
195
|
+
duration: track.duration,
|
|
196
|
+
thumbnail: track.artwork_url,
|
|
197
|
+
requestedBy,
|
|
198
|
+
source: this.name,
|
|
199
|
+
metadata: {
|
|
200
|
+
author: track.user?.username,
|
|
201
|
+
plays: track.playback_count,
|
|
202
|
+
},
|
|
203
|
+
}));
|
|
204
|
+
|
|
205
|
+
return { tracks };
|
|
206
|
+
} catch (error: any) {
|
|
207
|
+
throw new Error(`SoundCloud search failed: ${error?.message}`);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Retrieves the audio stream for a SoundCloud track.
|
|
213
|
+
*
|
|
214
|
+
* This method downloads the audio stream from SoundCloud using the track's URL.
|
|
215
|
+
* It handles the SoundCloud-specific download process and returns the stream
|
|
216
|
+
* in a format compatible with the player.
|
|
217
|
+
*
|
|
218
|
+
* @param track - The Track object to get the stream for
|
|
219
|
+
* @returns A StreamInfo object containing the audio stream and metadata
|
|
220
|
+
* @throws {Error} If the track URL is invalid or stream download fails
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* const track = { id: "123", title: "Track Title", url: "https://soundcloud.com/artist/track", ... };
|
|
224
|
+
* const streamInfo = await plugin.getStream(track);
|
|
225
|
+
* console.log(streamInfo.type); // "arbitrary"
|
|
226
|
+
* console.log(streamInfo.stream); // Readable stream
|
|
227
|
+
*/
|
|
228
|
+
async getStream(track: Track): Promise<StreamInfo> {
|
|
229
|
+
await this.ready;
|
|
230
|
+
|
|
231
|
+
try {
|
|
232
|
+
const stream = await this.client.downloadTrack(track.url);
|
|
233
|
+
if (!stream) {
|
|
234
|
+
throw new Error("SoundCloud download returned null");
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return {
|
|
238
|
+
stream,
|
|
239
|
+
type: "arbitrary",
|
|
240
|
+
metadata: track.metadata,
|
|
241
|
+
};
|
|
242
|
+
} catch (error: any) {
|
|
243
|
+
throw new Error(`Failed to get SoundCloud stream: ${error.message}`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Gets related tracks for a given SoundCloud track.
|
|
249
|
+
*
|
|
250
|
+
* This method fetches related tracks from SoundCloud's recommendation system
|
|
251
|
+
* based on the provided track URL or ID. It can filter out tracks that are
|
|
252
|
+
* already in the history to avoid duplicates.
|
|
253
|
+
*
|
|
254
|
+
* @param trackURL - The SoundCloud track URL or ID to get related tracks for
|
|
255
|
+
* @param opts - Options for filtering and limiting results
|
|
256
|
+
* @param opts.limit - Maximum number of related tracks to return (default: 1)
|
|
257
|
+
* @param opts.offset - Number of tracks to skip from the beginning (default: 0)
|
|
258
|
+
* @param opts.history - Array of tracks to exclude from results
|
|
259
|
+
* @returns An array of related Track objects
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* const related = await plugin.getRelatedTracks(
|
|
263
|
+
* "https://soundcloud.com/artist/track",
|
|
264
|
+
* { limit: 3, history: [currentTrack] }
|
|
265
|
+
* );
|
|
266
|
+
* console.log(`Found ${related.length} related tracks`);
|
|
267
|
+
*/
|
|
268
|
+
async getRelatedTracks(
|
|
269
|
+
trackURL: string | number,
|
|
270
|
+
opts: { limit?: number; offset?: number; history?: Track[] } = {},
|
|
271
|
+
): Promise<Track[]> {
|
|
272
|
+
await this.ready;
|
|
273
|
+
try {
|
|
274
|
+
const tracks = await this.client.getRelatedTracks(trackURL, {
|
|
275
|
+
limit: 30,
|
|
276
|
+
filter: "tracks",
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
if (!tracks || !tracks?.length) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
const relatedfilter = tracks.filter((tr: any) => !(opts?.history ?? []).some((t) => t.url === tr.permalink_url));
|
|
283
|
+
|
|
284
|
+
const related = relatedfilter.slice(0, opts.limit || 1);
|
|
285
|
+
|
|
286
|
+
return related.map((t: any) => ({
|
|
287
|
+
id: t.id.toString(),
|
|
288
|
+
title: t.title,
|
|
289
|
+
url: t.permalink_url,
|
|
290
|
+
duration: t.duration,
|
|
291
|
+
thumbnail: t.artwork_url,
|
|
292
|
+
requestedBy: "auto",
|
|
293
|
+
source: this.name,
|
|
294
|
+
metadata: {
|
|
295
|
+
author: t.user?.username,
|
|
296
|
+
plays: t.playback_count,
|
|
297
|
+
},
|
|
298
|
+
}));
|
|
299
|
+
} catch {
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Provides a fallback stream by searching for the track title.
|
|
306
|
+
*
|
|
307
|
+
* This method is used when the primary stream extraction fails. It performs
|
|
308
|
+
* a search using the track's title and attempts to get a stream from the
|
|
309
|
+
* first search result.
|
|
310
|
+
*
|
|
311
|
+
* @param track - The Track object to get a fallback stream for
|
|
312
|
+
* @returns A StreamInfo object containing the fallback audio stream
|
|
313
|
+
* @throws {Error} If no fallback track is found or stream extraction fails
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* try {
|
|
317
|
+
* const stream = await plugin.getStream(track);
|
|
318
|
+
* } catch (error) {
|
|
319
|
+
* // Try fallback
|
|
320
|
+
* const fallbackStream = await plugin.getFallback(track);
|
|
321
|
+
* }
|
|
322
|
+
*/
|
|
323
|
+
async getFallback(track: Track): Promise<StreamInfo> {
|
|
324
|
+
const trackfall = await this.search(track.title, track.requestedBy);
|
|
325
|
+
const fallbackTrack = trackfall.tracks?.[0];
|
|
326
|
+
if (!fallbackTrack) {
|
|
327
|
+
throw new Error(`No fallback track found for ${track.title}`);
|
|
328
|
+
}
|
|
329
|
+
return await this.getStream(fallbackTrack);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Extracts tracks from a SoundCloud playlist URL.
|
|
334
|
+
*
|
|
335
|
+
* @param url - The SoundCloud playlist URL
|
|
336
|
+
* @param requestedBy - The user ID who requested the extraction
|
|
337
|
+
* @returns An array of Track objects from the playlist
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* const tracks = await plugin.extractPlaylist(
|
|
341
|
+
* "https://soundcloud.com/artist/sets/playlist-name",
|
|
342
|
+
* "user123"
|
|
343
|
+
* );
|
|
344
|
+
* console.log(`Found ${tracks.length} tracks in playlist`);
|
|
345
|
+
*/
|
|
346
|
+
async extractPlaylist(url: string, requestedBy: string): Promise<Track[]> {
|
|
347
|
+
await this.ready;
|
|
348
|
+
try {
|
|
349
|
+
const playlist = await this.client.getPlaylistDetails(url);
|
|
350
|
+
return playlist.tracks.map((t: any) => ({
|
|
351
|
+
id: t.id.toString(),
|
|
352
|
+
title: t.title,
|
|
353
|
+
url: t.permalink_url,
|
|
354
|
+
duration: t.duration,
|
|
355
|
+
thumbnail: t.artwork_url || playlist.artwork_url,
|
|
356
|
+
requestedBy,
|
|
357
|
+
source: this.name,
|
|
358
|
+
metadata: {
|
|
359
|
+
author: t.user?.username,
|
|
360
|
+
plays: t.playback_count,
|
|
361
|
+
playlist: playlist.id?.toString(),
|
|
362
|
+
},
|
|
363
|
+
}));
|
|
364
|
+
} catch {
|
|
365
|
+
return [];
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
package/src/TTSPlugin.ts
CHANGED
|
@@ -208,7 +208,7 @@ export class TTSPlugin extends BasePlugin {
|
|
|
208
208
|
*/
|
|
209
209
|
async getStream(track: Track): Promise<StreamInfo> {
|
|
210
210
|
const cfg = this.extractConfig(track);
|
|
211
|
-
|
|
211
|
+
if (track.source !== this.name) return {stream:null as any, type:"arbitrary" };
|
|
212
212
|
if (this.opts.createStream && typeof this.opts.createStream === "function") {
|
|
213
213
|
const out = await this.opts.createStream(cfg.text, { lang: cfg.lang, slow: cfg.slow, track });
|
|
214
214
|
let type: StreamInfo["type"] | undefined;
|
package/src/YTSRPlugin.ts
CHANGED
|
@@ -281,11 +281,30 @@ export class YTSRPlugin extends BasePlugin {
|
|
|
281
281
|
* @returns Track object
|
|
282
282
|
*/
|
|
283
283
|
private buildTrackFromVideo(video: Video, requestedBy: string): Track {
|
|
284
|
+
// Xử lý duration một cách an toàn
|
|
285
|
+
let duration = 0;
|
|
286
|
+
if (video.duration) {
|
|
287
|
+
if (typeof video.duration === "number") {
|
|
288
|
+
duration = video.duration;
|
|
289
|
+
} else if (typeof video.duration === "object" && video.duration !== null) {
|
|
290
|
+
// Nếu duration là object, thử lấy seconds
|
|
291
|
+
duration = (video.duration as any)?.seconds || (video.duration as any)?.totalSeconds || 0;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// youtube-sr trả về duration theo milliseconds, chuyển thành seconds
|
|
296
|
+
if (duration > 0) {
|
|
297
|
+
// Nếu duration lớn hơn 1000, có thể là milliseconds
|
|
298
|
+
if (duration > 1000) {
|
|
299
|
+
duration = Math.floor(duration / 1000);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
284
303
|
return {
|
|
285
304
|
id: video.id,
|
|
286
305
|
title: video.title,
|
|
287
306
|
url: video.url,
|
|
288
|
-
duration:
|
|
307
|
+
duration: Math.max(0, duration), // Đảm bảo duration không âm
|
|
289
308
|
thumbnail: video.thumbnail?.url || (video as any).thumbnails?.[0]?.url,
|
|
290
309
|
requestedBy,
|
|
291
310
|
source: this.name,
|
package/src/index.ts
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Main export file for ZiPlayer plugins.
|
|
3
|
-
*
|
|
4
|
-
* This module exports all available plugins for the ZiPlayer music bot framework.
|
|
5
|
-
* Each plugin provides support for different audio sources and services.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* import { YouTubePlugin, SoundCloudPlugin, SpotifyPlugin, TTSPlugin } from "ziplayer/plugins";
|
|
9
|
-
*
|
|
10
|
-
* const manager = new PlayerManager({
|
|
11
|
-
* plugins: [
|
|
12
|
-
* new YouTubePlugin(),
|
|
13
|
-
* new SoundCloudPlugin(),
|
|
14
|
-
* new SpotifyPlugin(),
|
|
15
|
-
* new TTSPlugin({ defaultLang: "en" })
|
|
16
|
-
* ]
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* @since 1.0.0
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* YouTube plugin for handling YouTube videos, playlists, and search.
|
|
24
|
-
*
|
|
25
|
-
* Provides comprehensive support for YouTube content including:
|
|
26
|
-
* - Video URLs (youtube.com, youtu.be, music.youtube.com)
|
|
27
|
-
* - Playlist URLs and dynamic mixes
|
|
28
|
-
* - Search functionality
|
|
29
|
-
* - Audio stream extraction
|
|
30
|
-
* - Related track recommendations
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* const youtubePlugin = new YouTubePlugin();
|
|
34
|
-
* const result = await youtubePlugin.search("Never Gonna Give You Up", "user123");
|
|
35
|
-
*/
|
|
36
|
-
export { YouTubePlugin } from "./YouTubePlugin";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* SoundCloud plugin for handling SoundCloud tracks, playlists, and search.
|
|
40
|
-
*
|
|
41
|
-
* Provides comprehensive support for SoundCloud content including:
|
|
42
|
-
* - Track URLs (soundcloud.com)
|
|
43
|
-
* - Playlist URLs
|
|
44
|
-
* - Search functionality
|
|
45
|
-
* - Audio stream extraction
|
|
46
|
-
* - Related track recommendations
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
50
|
-
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
51
|
-
*/
|
|
52
|
-
export { SoundCloudPlugin } from "./SoundCloudPlugin";
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Spotify plugin for metadata extraction and display purposes.
|
|
56
|
-
*
|
|
57
|
-
* **Note:** This plugin only provides metadata extraction and does not support
|
|
58
|
-
* audio streaming. It uses Spotify's public oEmbed endpoint for display purposes.
|
|
59
|
-
*
|
|
60
|
-
* Provides support for:
|
|
61
|
-
* - Track URLs/URIs (spotify:track:...)
|
|
62
|
-
* - Playlist URLs/URIs (spotify:playlist:...)
|
|
63
|
-
* - Album URLs/URIs (spotify:album:...)
|
|
64
|
-
* - Metadata extraction using oEmbed API
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* const spotifyPlugin = new SpotifyPlugin();
|
|
68
|
-
* const result = await spotifyPlugin.search("spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "user123");
|
|
69
|
-
*/
|
|
70
|
-
export { SpotifyPlugin } from "./SpotifyPlugin";
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Text-to-Speech (TTS) plugin for converting text to audio.
|
|
74
|
-
*
|
|
75
|
-
* Provides comprehensive TTS functionality including:
|
|
76
|
-
* - Google TTS integration
|
|
77
|
-
* - Custom TTS provider support
|
|
78
|
-
* - Multiple language support
|
|
79
|
-
* - Configurable speech rate
|
|
80
|
-
* - Flexible query parsing
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
* const ttsPlugin = new TTSPlugin({ defaultLang: "en" });
|
|
84
|
-
* const result = await ttsPlugin.search("tts:Hello world", "user123");
|
|
85
|
-
*/
|
|
86
|
-
export { TTSPlugin } from "./TTSPlugin";
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* YTSR plugin for advanced YouTube search without streaming.
|
|
90
|
-
*
|
|
91
|
-
* Provides comprehensive YouTube search functionality including:
|
|
92
|
-
* - Advanced video search with filters (duration, upload date, sort by)
|
|
93
|
-
* - Playlist and channel search
|
|
94
|
-
* - Multiple search types (video, playlist, channel, all)
|
|
95
|
-
* - Metadata extraction without streaming
|
|
96
|
-
* - Support for YouTube URLs
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* const ytsrPlugin = new YTSRPlugin();
|
|
100
|
-
* const result = await ytsrPlugin.search("Never Gonna Give You Up", "user123");
|
|
101
|
-
* const playlistResult = await ytsrPlugin.searchPlaylist("chill music", "user123");
|
|
102
|
-
*/
|
|
103
|
-
export { YTSRPlugin } from "./YTSRPlugin";
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Main export file for ZiPlayer plugins.
|
|
3
|
+
*
|
|
4
|
+
* This module exports all available plugins for the ZiPlayer music bot framework.
|
|
5
|
+
* Each plugin provides support for different audio sources and services.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* import { YouTubePlugin, SoundCloudPlugin, SpotifyPlugin, TTSPlugin } from "ziplayer/plugins";
|
|
9
|
+
*
|
|
10
|
+
* const manager = new PlayerManager({
|
|
11
|
+
* plugins: [
|
|
12
|
+
* new YouTubePlugin(),
|
|
13
|
+
* new SoundCloudPlugin(),
|
|
14
|
+
* new SpotifyPlugin(),
|
|
15
|
+
* new TTSPlugin({ defaultLang: "en" })
|
|
16
|
+
* ]
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* @since 1.0.0
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* YouTube plugin for handling YouTube videos, playlists, and search.
|
|
24
|
+
*
|
|
25
|
+
* Provides comprehensive support for YouTube content including:
|
|
26
|
+
* - Video URLs (youtube.com, youtu.be, music.youtube.com)
|
|
27
|
+
* - Playlist URLs and dynamic mixes
|
|
28
|
+
* - Search functionality
|
|
29
|
+
* - Audio stream extraction
|
|
30
|
+
* - Related track recommendations
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const youtubePlugin = new YouTubePlugin();
|
|
34
|
+
* const result = await youtubePlugin.search("Never Gonna Give You Up", "user123");
|
|
35
|
+
*/
|
|
36
|
+
export { YouTubePlugin } from "./YouTubePlugin";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* SoundCloud plugin for handling SoundCloud tracks, playlists, and search.
|
|
40
|
+
*
|
|
41
|
+
* Provides comprehensive support for SoundCloud content including:
|
|
42
|
+
* - Track URLs (soundcloud.com)
|
|
43
|
+
* - Playlist URLs
|
|
44
|
+
* - Search functionality
|
|
45
|
+
* - Audio stream extraction
|
|
46
|
+
* - Related track recommendations
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* const soundcloudPlugin = new SoundCloudPlugin();
|
|
50
|
+
* const result = await soundcloudPlugin.search("chill music", "user123");
|
|
51
|
+
*/
|
|
52
|
+
export { SoundCloudPlugin } from "./SoundCloudPlugin";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Spotify plugin for metadata extraction and display purposes.
|
|
56
|
+
*
|
|
57
|
+
* **Note:** This plugin only provides metadata extraction and does not support
|
|
58
|
+
* audio streaming. It uses Spotify's public oEmbed endpoint for display purposes.
|
|
59
|
+
*
|
|
60
|
+
* Provides support for:
|
|
61
|
+
* - Track URLs/URIs (spotify:track:...)
|
|
62
|
+
* - Playlist URLs/URIs (spotify:playlist:...)
|
|
63
|
+
* - Album URLs/URIs (spotify:album:...)
|
|
64
|
+
* - Metadata extraction using oEmbed API
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* const spotifyPlugin = new SpotifyPlugin();
|
|
68
|
+
* const result = await spotifyPlugin.search("spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "user123");
|
|
69
|
+
*/
|
|
70
|
+
export { SpotifyPlugin } from "./SpotifyPlugin";
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Text-to-Speech (TTS) plugin for converting text to audio.
|
|
74
|
+
*
|
|
75
|
+
* Provides comprehensive TTS functionality including:
|
|
76
|
+
* - Google TTS integration
|
|
77
|
+
* - Custom TTS provider support
|
|
78
|
+
* - Multiple language support
|
|
79
|
+
* - Configurable speech rate
|
|
80
|
+
* - Flexible query parsing
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const ttsPlugin = new TTSPlugin({ defaultLang: "en" });
|
|
84
|
+
* const result = await ttsPlugin.search("tts:Hello world", "user123");
|
|
85
|
+
*/
|
|
86
|
+
export { TTSPlugin } from "./TTSPlugin";
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* YTSR plugin for advanced YouTube search without streaming.
|
|
90
|
+
*
|
|
91
|
+
* Provides comprehensive YouTube search functionality including:
|
|
92
|
+
* - Advanced video search with filters (duration, upload date, sort by)
|
|
93
|
+
* - Playlist and channel search
|
|
94
|
+
* - Multiple search types (video, playlist, channel, all)
|
|
95
|
+
* - Metadata extraction without streaming
|
|
96
|
+
* - Support for YouTube URLs
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* const ytsrPlugin = new YTSRPlugin();
|
|
100
|
+
* const result = await ytsrPlugin.search("Never Gonna Give You Up", "user123");
|
|
101
|
+
* const playlistResult = await ytsrPlugin.searchPlaylist("chill music", "user123");
|
|
102
|
+
*/
|
|
103
|
+
export { YTSRPlugin } from "./YTSRPlugin";
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2020"],
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"allowSyntheticDefaultImports": true,
|
|
17
|
-
"experimentalDecorators": true,
|
|
18
|
-
"emitDecoratorMetadata": true,
|
|
19
|
-
"resolveJsonModule": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/*"],
|
|
22
|
-
"exclude": ["node_modules", "dist", "examples"]
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"emitDecoratorMetadata": true,
|
|
19
|
+
"resolveJsonModule": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist", "examples"]
|
|
23
|
+
}
|