@zibot/scdl 0.0.2 → 0.0.3
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/index.d.ts +1 -6
- package/index.js +3 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -38,11 +38,6 @@ interface User {
|
|
|
38
38
|
track_count: number;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
interface SearchResponse {
|
|
42
|
-
collection: (Track | Playlist | User)[];
|
|
43
|
-
next_href?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
41
|
declare class SoundCloud {
|
|
47
42
|
clientId: string | null;
|
|
48
43
|
apiBaseUrl: string;
|
|
@@ -57,7 +52,7 @@ declare class SoundCloud {
|
|
|
57
52
|
/**
|
|
58
53
|
* Search for tracks, playlists, or users on SoundCloud.
|
|
59
54
|
*/
|
|
60
|
-
searchTracks(options: SearchOptions): Promise<
|
|
55
|
+
searchTracks(options: SearchOptions): Promise<(Track | Playlist | User)[]>;
|
|
61
56
|
|
|
62
57
|
/**
|
|
63
58
|
* Retrieve detailed information about a single track.
|
package/index.js
CHANGED
|
@@ -38,14 +38,14 @@ class SoundCloud {
|
|
|
38
38
|
)}&limit=${limit}&offset=${offset}&access=playable&client_id=${this.clientId}`;
|
|
39
39
|
try {
|
|
40
40
|
const { data } = await axios.get(url);
|
|
41
|
+
|
|
41
42
|
if (!data || !data?.collection?.length) {
|
|
42
43
|
return [];
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
return data.collection.filter((track) => {
|
|
46
|
-
if (!track.permalink_url) return false;
|
|
47
|
-
|
|
48
|
-
if (!track.duration) return false;
|
|
47
|
+
if (!track.permalink_url || !track.title || !track.duration) return false;
|
|
48
|
+
return true;
|
|
49
49
|
});
|
|
50
50
|
} catch (error) {
|
|
51
51
|
console.error("Search error:", error.message || error);
|