From 35dcb7288d16cbdf26a625167c71f4bdc2a43ff6 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 18 Oct 2021 15:38:05 +0530 Subject: [PATCH 1/3] Spotify tracksCount name error fixed --- play-dl/Spotify/classes.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/play-dl/Spotify/classes.ts b/play-dl/Spotify/classes.ts index e0643f7..b9b6f7e 100644 --- a/play-dl/Spotify/classes.ts +++ b/play-dl/Spotify/classes.ts @@ -200,7 +200,7 @@ export class SpotifyAlbum { copyrights: SpotifyCopyright[]; release_date: string; release_date_precision: string; - trackCount: number; + tracksCount: number; private spotifyData: SpotifyDataOptions; private fetched_tracks: Map; constructor(data: any, spotifyData: SpotifyDataOptions) { @@ -221,7 +221,7 @@ export class SpotifyAlbum { this.copyrights = data.copyrights; this.release_date = data.release_date; this.release_date_precision = data.release_date_precision; - this.trackCount = data.total_tracks; + this.tracksCount = data.total_tracks; const videos: SpotifyTrack[] = []; data.tracks.items.forEach((v: any) => { videos.push(new SpotifyTrack(v)); @@ -233,8 +233,8 @@ export class SpotifyAlbum { async fetch() { let fetching: number; - if (this.trackCount > 500) fetching = 500; - else fetching = this.trackCount; + if (this.tracksCount > 500) fetching = 500; + else fetching = this.tracksCount; if (fetching <= 50) return; const work = []; for (let i = 2; i <= Math.ceil(fetching / 50); i++) { From 2a6a93701e96bcc52ab0e190e794224276f5fbf5 Mon Sep 17 00:00:00 2001 From: killer069 <65385476+killer069@users.noreply.github.com> Date: Mon, 18 Oct 2021 17:11:48 +0530 Subject: [PATCH 2/3] soundcloud free client ID --- docs/SoundCloud/README.md | 14 ++++++++++++++ play-dl/SoundCloud/index.ts | 17 +++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/docs/SoundCloud/README.md b/docs/SoundCloud/README.md index 6b2b2bf..61522ec 100644 --- a/docs/SoundCloud/README.md +++ b/docs/SoundCloud/README.md @@ -12,6 +12,20 @@ let data = await soundcloud(url) //Gets the data console.log(data.type) // Console logs the type of data that you got. ``` +### getFreeClientID() + +_This returns free client ID._ + +```js +const client_id = await getFreeClientID() + +setToken({ + soundcloud : { + client_id : client_id + } +}) // This will set client ID for use in play-dl. +``` + ## Validate ### so_validate(url : `string`) diff --git a/play-dl/SoundCloud/index.ts b/play-dl/SoundCloud/index.ts index 9c37e49..384dc15 100644 --- a/play-dl/SoundCloud/index.ts +++ b/play-dl/SoundCloud/index.ts @@ -85,6 +85,23 @@ export async function stream(url: string, quality?: number): Promise { : StreamType.Arbitrary; return new Stream(s_data.url, type); } +/** + * Function to get Free Client ID of soundcloud. + * @returns client ID + */ +export async function getFreeClientID(): Promise{ + const data = await request('https://soundcloud.com/') + const splitted = data.split('