Updated guides

This commit is contained in:
Zechariah 2022-03-30 22:20:58 +08:00
parent 7930df4f5a
commit 4a181fdbf7
2 changed files with 1 additions and 119 deletions

View File

@ -37,5 +37,5 @@ pnpm i ytmusic-api
import YTMusic from "ytmusic-api" import YTMusic from "ytmusic-api"
// Node Require // Node Require
const YTMusic = require("ytmusic-api") const YTMusic = require("ytmusic-api").default
``` ```

View File

@ -10,121 +10,3 @@ ytmusic.initialize().then(() => {
// Use API here // Use API here
}) })
``` ```
## `getSearchSuggestions` function
`getSearchSuggestions()` will fetch you a list of search suggestions based on the query
```ts
ytmusic.getSearchSuggestions("Lilac").then(res => {
console.log(res)
})
// > [
// > "lilac",
// > "lilac iu",
// > "lilac band",
// > "lilac wine",
// > "lilac wine miley cyrus",
// > "lilac close my eyes forever",
// > "lilac holy diver"
// > ]
```
## `search` function
`search()` will fetch search results from YouTube Music directly based on the query and result type provided
### `search` for songs
### `search` for videos
### `search` for artists
### `search` for albums
### `search` for playlists
This function takes in the following parameters
The function **when nothing is passed as the category** returns a `Promise<`[SearchResult](#SearchResult)`[]>` which are the search results of all categories
```ts
ytmusic.search("Lilac").then(results => {
console.log(results)
})
```
##### `search (category = "SONG")`
When you pass in `"SONG"` as the category,
The function returns a `Promise<`[SongDetailed](#SongDetailed)`[]>` which are the song results
```ts
ytmusic.search("Lilac", "SONG").then(songs => {
console.log(songs)
})
```
##### `search (category = "VIDEO")`
When you pass in `"VIDEO"` as the category,
The function returns a `Promise<`[VideoDetailed](#VideoDetailed)`[]>` which are the video results
```ts
ytmusic.search("Lilac", "VIDEO").then(videos => {
console.log(videos)
})
```
##### `search (category = "ARTIST")`
When you pass in `"ARTIST"` as the category
The function returns a `Promise<`[ArtistDetailed](#ArtistDetailed)`[]>` which are the artist results
```ts
ytmusic.search("Lilac", "ARTIST").then(artists => {
console.log(artists)
})
```
##### `search (category = "ALBUM")`
When you pass in `"ALBUM"` as the category,
The function returns a `Promise<`[AlbumDetailed](#AlbumDetailed)`[]>` which are the album results
```ts
ytmusic.search("Lilac", "ALBUM").then(albums => {
console.log(albums)
})
```
##### `search (category = "PLAYLIST")`
When you pass in `"PLAYLIST"` as the category,
The function returns a `Promise<`[PlaylistFull](#PlaylistFull)`[]>` which are the playlist results
```ts
ytmusic.search("Lilac", "PLAYLIST").then(playlists => {
console.log(playlists)
})
```
## `getSong` function
## `getVideo` function
## `getArtist` function
## `getArtistVideo` function
## `getArtistAlbums` function
## `getAlbum` function
## `getPlaylist` function
## `getPlaylistVideos` function