Files
play-dl-test/docs/SoundCloud/README.md

116 lines
2.2 KiB
Markdown
Raw Normal View History

2021-09-21 13:00:38 +05:30
# SoundCloud
## Main
### soundcloud(url : `string`)
_This returns data from a track | playlist url._
```js
let data = await soundcloud(url) //Gets the data
console.log(data.type) // Console logs the type of data that you got.
```
2021-10-18 17:11:48 +05:30
### 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.
```
2021-09-21 13:00:38 +05:30
## Validate
### so_validate(url : `string`)
_This checks that given url is soundcloud url or not._
2021-10-09 18:59:16 +05:30
**Returns :** `track` | `playlist` | `search` | `false`
2021-09-21 13:00:38 +05:30
```js
let check = await so_validate(url)
if(!check) // Invalid SoundCloud URL
if(check === 'track') // SoundCloud Track URL
2021-10-09 18:59:16 +05:30
if(check === "search") // Given term is not a SoundCloud URL. Search this somewhere.
2021-09-21 13:00:38 +05:30
```
2021-09-21 15:26:59 +05:30
## Classes [ Returned by `soundcloud(url)` function ]
2021-09-21 13:00:38 +05:30
### SoundCloudTrack
_This is class for a soundcloud track._
##### type `property`
_This will always return as "track" for this class._
##### toJSON() `function`
_converts class into a json format_
### SoundCloudPlaylist
_This is a soundcloud playlist class._
##### fetch() `function`
_This will fetch tracks in a playlist._
```js
let data = await soundcloud(playlist_url)
await data.fetch() // Fetches all unfetched tracks in playlist
```
##### tracksCount `property`
_This will give no. of tracks in a playlist._
```js
let data = await soundcloud(playlist_url)
console.log(data.tracksCount) // Returns total tracks count in a playlist
```
#### tracks `property`
_This will give all tracks fetched as array._
```js
let data = await soundcloud(playlist_url)
console.log(data.tracks) // Tracks Array
data.tracks.forEach((track) => {
queue.push(track) // This will push every track in playlist to your queue
})
```
#### total_tracks `property`
_This give total videos that have been fetched so far._
```js
2021-09-21 16:02:01 +05:30
let data = await soundcloud(playlist_url)
2021-09-21 13:00:38 +05:30
2021-09-21 16:02:01 +05:30
console.log(data.total_tracks) // This will tell no. of videos that have been fetched so far.
2021-09-21 13:00:38 +05:30
```
##### type `property`
_This will always return as "playlist" for this class._
##### toJSON() `function`
_converts class into a json format_