soundcloud free client ID
This commit is contained in:
parent
cdc1d7aeb5
commit
2a6a93701e
@ -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.
|
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
|
## Validate
|
||||||
|
|
||||||
### so_validate(url : `string`)
|
### so_validate(url : `string`)
|
||||||
|
|||||||
@ -85,6 +85,23 @@ export async function stream(url: string, quality?: number): Promise<Stream> {
|
|||||||
: StreamType.Arbitrary;
|
: StreamType.Arbitrary;
|
||||||
return new Stream(s_data.url, type);
|
return new Stream(s_data.url, type);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Function to get Free Client ID of soundcloud.
|
||||||
|
* @returns client ID
|
||||||
|
*/
|
||||||
|
export async function getFreeClientID(): Promise<string>{
|
||||||
|
const data = await request('https://soundcloud.com/')
|
||||||
|
const splitted = data.split('<script crossorigin src="')
|
||||||
|
const urls: string[] = []
|
||||||
|
splitted.forEach((r) => {
|
||||||
|
if(r.startsWith('https')) {
|
||||||
|
urls.push(r.split('"')[0])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const data2 = await request(urls[urls.length - 1])
|
||||||
|
return data2.split(',client_id:"')[1].split('"')[0]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type for SoundCloud Stream
|
* Type for SoundCloud Stream
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user