ts-npm-ytmusic-api/docs/guides/usage.md

20 lines
485 B
Markdown

# Usage
YTMusic provides you many ways of fetching data from YouTube Music<br />
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
```ts
const ytmusic = new YTMusic()
ytmusic.initialize().then(() => {
// Use API here
})
```
In an async context, you can initialize the API in one line
```ts
const ytmusic = await new YTMusic().initalize()
// Use API here
```