2021-10-01 12:50:40 +05:30
..
2021-09-21 16:02:01 +05:30
2021-09-24 08:51:08 +05:30
2021-10-01 12:50:12 +05:30
2021-10-01 12:50:40 +05:30

Play-dl commands

For source specific commands :-

Validate

validate(url : string)

This checks all type of urls that are supported by play-dl.

Returns : so_playlist | so_track | sp_track | sp_album | sp_playlist | yt_video | yt_playlist | false

so = SoundCloud

sp = Spotify

yt = YouTube

let check = await validate(url)

if(!check) // Invalid URL

if(check === 'yt_video') // YouTube Video

if(check === 'sp_track') // Spotify Track

if(check === 'so_track') // SoundCloud Track

authorization()

This creates basic spotify / soundcloud data to be stored locally.

authorization() //After then you will be asked about type of data you want to create and then follow the steps properly.

SearchOptions :

  • limit : number :- Sets total amount of results you want.

  • source : {

    youtube: video | playlist | channel ;

    spotify: album | playlist | track ;

    soundcloud: tracks | playlists | albums ;

    }

search(query : string, options? : SearchOptions)

This is basic to search with any source.

NOTE :- If options.source is not specified, then it will default to youtube video search.

let data = await search('Rick Roll', { limit : 1 }) // Searches for youtube video

let data = await search('Rick Roll', { limit : 1, source : { youtube : "video" } }) // Searches for youtube video

let data = await search('Rick Roll', { limit: 1, source : { spotify : "track" } }) // Searches for spotify track.

let data = await search('Rick Roll', { limit: 1, source : { soundcloud : "tracks" } }) // Searches for soundcloud track.

Stream

StreamOptions :

  • quality : number :- Sets quality of stream [ 0 = Lowest, 1 = Medium ]. Leave this empty to get highest audio quality.
  • cookie : string :- Cookies are optional and are required for playing age restricted videos.
  • proxy : Proxy :- Optional parameter to add support of proxies. As of now, HTTPS proxies are only supported. So make sure to get HTTPS proxies only.

stream(url : string, options? : StreamOptions)

This is basic to create a stream from a youtube or soundcloud url.

let source = await stream("url") // This will create a stream Class. Highest Quality

let source = await stream("url", { quality : 0 }) // Lowest quality

let source = await stream("url", { quality : 1 }) // Next to Lowest quality.

let source = await stream("url", { cookie: COOKIE }) //This will create a stream Class and also give cookies.

let source = await stream(url, { proxy : ['url'] }) // Accepts a url which has port in it.

let source = await stream(url. {proxy : [{
        host : "IP or hostname",
        port : 8080
    }]
}) // Or add a json containing hostname and port.

let resource = createAudioResource(source.stream, {
            inputType : source.type
        }) // This creates resource for playing

stream_from_info(info : infoData, options? : StreamOptions)

This is basic to create a stream from a info [ from video_info function or soundcloud function [Only SoundCloudTrack class is allowed] ].

Note : Here, cookies are required only for retrying purposes.

let source = await stream_from_info(info) // This will create a stream Class from video_info or SoundCoudTrack Class. Highest Quality

let source = await stream_from_info(info, { quality : 0 }) // Lowest quality

let source = await stream_from_info(info, { quality : 1 }) // Next to Lowest quality.

let source = await stream_from_info(info, { cookie: COOKIE }) //This will create a stream Class and also give cookies if retrying.


let source = await stream_from_info(info, { proxy : ['url'] }) // Accepts a url which has port in it.

let source = await stream_from_info(info, {proxy : [{
        host : "IP or hostname",
        port : 8080
    }]
}) // Or add a json containing hostname and port.

let resource = createAudioResource(source.stream, {
            inputType : source.type
        }) // This creates resource for playing