Added usage.md and wrote getSearchSuggestions
This commit is contained in:
parent
58e70e6c08
commit
1cd464b9bc
18
README.md
18
README.md
|
|
@ -21,24 +21,6 @@ Because of this, I decided to build my own version of a youtube music api with T
|
||||||
- Albums
|
- Albums
|
||||||
- Playlists
|
- Playlists
|
||||||
|
|
||||||
### Methods to fetch data
|
|
||||||
|
|
||||||
#### `getSearchSuggestions`
|
|
||||||
|
|
||||||
This function takes in the following parameters
|
|
||||||
|
|
||||||
| Name | Data Type | Description |
|
|
||||||
| :---- | :-------- | :------------------------------------ |
|
|
||||||
| query | `string` | Search query you want suggestions for |
|
|
||||||
|
|
||||||
The function returns a `Promise<string[]>` which are the suggestion results
|
|
||||||
|
|
||||||
```ts
|
|
||||||
ytmusic.getSearchSuggestions("Lilac").then(res => {
|
|
||||||
console.log(res)
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `search`
|
#### `search`
|
||||||
|
|
||||||
This function takes in the following parameters
|
This function takes in the following parameters
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ export default defineUserConfig<DefaultThemeOptions>({
|
||||||
text: "Getting Started",
|
text: "Getting Started",
|
||||||
link: "/docs/getting-started.html"
|
link: "/docs/getting-started.html"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
text: "Usage",
|
||||||
|
link: "/docs/usage.html"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: "References",
|
text: "References",
|
||||||
link: "/docs/references.html"
|
link: "/docs/references.html"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,24 @@
|
||||||
|
|
||||||
### `getSearchSuggestions`
|
### `getSearchSuggestions`
|
||||||
|
|
||||||
|
::: tip Properties
|
||||||
|
|
||||||
|
| Name | Data Type | Description |
|
||||||
|
| :------ | :-------- | :------------------------------------ |
|
||||||
|
| `query` | `string` | Search query you want suggestions for |
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
::: tip Returns
|
||||||
|
|
||||||
|
`Promise<string[]>`
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
```ts
|
||||||
|
public async getSearchSuggestions(query: string): Promise<string[]>
|
||||||
|
```
|
||||||
|
|
||||||
### `search`
|
### `search`
|
||||||
|
|
||||||
### `getSong`
|
### `getSong`
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
# 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
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
## `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
|
||||||
|
|
||||||
|
## `getSong` function
|
||||||
|
|
||||||
|
## `getVideo` function
|
||||||
|
|
||||||
|
## `getArtist` function
|
||||||
|
|
||||||
|
## `getArtistVideo` function
|
||||||
|
|
||||||
|
## `getArtistAlbums` function
|
||||||
|
|
||||||
|
## `getAlbum` function
|
||||||
|
|
||||||
|
## `getPlaylist` function
|
||||||
|
|
||||||
|
## `getPlaylistVideos` function
|
||||||
Loading…
Reference in New Issue