692 B
692 B
Usage
YTMusic provides you with many ways of fetching data from YouTube Music
To leverage all the functions, we will need to create an instance of the class YTMusic.
Then, call the initialize() to initialize the API before using the API anywhere
const ytmusic = new YTMusic()
ytmusic.initialize().then(() => {
// Use API here
})
In an async context, you can initialize the API in one line
const ytmusic = await new YTMusic().initialize()
// Use API here
Custom Cookies
If you want to use your own cookies for all requests, you can do so like this
const ytmusic = await new YTMusic()
.initialize("COOKIES=here; COOKIES=here; COOKIES=here")