twlite / soundcloud-scraper

☁️ Get basic informations about a song from a SoundCloud URL
https://soundcloud-scraper.js.org
67 stars 16 forks source link

getPlaylist method doesnt give all tracks in playlist #11

Closed DaliborTrampota closed 3 years ago

DaliborTrampota commented 3 years ago

After calling a getPlaylist method and providing it this playlist https://soundcloud.com/billieeilish/sets/cry for testing purposes. tracks array property contains only 4 songs but trackCount property gives 18. And the songs are available in my country (czech republic) or atleast more that 4.

When trying to get this playlist https://soundcloud.com/scumgang6ix9ine/sets/day69-2

I get this error

(node:19596) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'url' of undefined
    at E:\GitHub\DiscordBots\Filter Music Bot\node_modules\soundcloud-scraper\src\Client.js:223:68
    at Array.map (<anonymous>)
    at E:\GitHub\DiscordBots\Filter Music Bot\node_modules\soundcloud-scraper\src\Client.js:197:35
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

these are my functions for loading the playlist but its not really related to the error

function addSoundcloudPlaylist(url, sQueue){
    return new Promise((resolve, reject) => {
        let playlist = [];
        SoundCloud.getPlaylist(url).then(res => {
            console.log(res.tracks.length, res.trackCount)
            for(let track of res.tracks){
                searchTitle(track.title).then(title => {
                    sQueue.addTitle(title)
                    playlist.push(title)
                })
            }
            resolve(true)
        }).catch(err => {
            console.log('here')
            reject(err);
        });
    });
}

function addSoundCloudTrack(url, sQueue){
    return new Promise((resolve, reject) => {
        SoundCloud.getSongInfo(url).then(song => {
            searchTitle(song.title).then(title => {
                sQueue.addTitle(title)
                resolve(title)
            }).catch(reject)
        }).catch(reject)
    })
}
DaliborTrampota commented 3 years ago

https://soundcloud.com/slowed-and-reverb-songs/sets/sad-slowed-and-reverb-songs this one gives only 5 songs but trackCount says 228

twlite commented 3 years ago

@DaliborTrampota yeah, this library does not use soundcloud api to get playlist. It means it only returns the tracks that are available inside page metadata

DaliborTrampota commented 3 years ago

@DaliborTrampota yeah, this library does not use soundcloud api to get playlist. It means it only returns the tracks that are available inside page metadata

Ok and what is the api key in constructor for then? And is there a workaround?

twlite commented 3 years ago

@DaliborTrampota That's for audio downloader.

DaliborTrampota commented 3 years ago

So there is no way to get atleast 50 of the songs in the playlist?

twlite commented 3 years ago

Not currently possible with this library.

twlite commented 3 years ago

Closing due to inactivity. Might re-open in the future