microlinkhq / spotify-url-info

Get metadata from any Spotify URL.
MIT License
72 stars 16 forks source link

How can i get all the total songs from a playlist instead of 100 limited songs from using your library. #75

Closed V3dantSh4rma closed 2 years ago

V3dantSh4rma commented 2 years ago

Ok so, I used your library to fetch songs from the playlist which has 100+ songs. Any way I can get all the songs? Here's my current code: make sure to read from the song.startsWith('https://open.spotify.com/playlist') part.


const {
    getData,
    getPreview,
    getTracks
} = require('spotify-url-info');

const {
    getData,
    getPreview,
    getTracks
} = require('spotify-url-info');
const ytsr = require('ytsr');

async function spotifyToYoutube(song){
    if(song.startsWith('https://open.spotify.com/track')){
        //Some code here.
    } else if(song.startsWith('https://open.spotify.com/playlist')){
        //Read from here.
        const playlistData = await getTracks(song);
        let songArray = [];
        for(let i = 0; i < playlistData.length; i++){
            songArray.push(playlistData[i].name);
        }
        console.log(songArray);
    } else if(!song){
        console.log('No song parameter given.');
    }
}

spotifyToYoutube('https://open.spotify.com/playlist/1GDDjhXuuL8iqjfVzIdWrM?si=4f5373ee1ec44d61').then(data => {});```
Kikobeats commented 2 years ago

Hello,

No idea to be honest; I use the library mainly for retrieving the song metadata rather than downloading them.

If anyone is reading this and knows the way, please feel free to share your knowledge 🙂