📝 simplify documentation

This commit is contained in:
zS1L3NT Mac 2023-12-28 04:35:09 +08:00
parent 7cb39bca6a
commit eea7becbe8
No known key found for this signature in database
GPG Key ID: 02BE07CD431E4F42
56 changed files with 20 additions and 1306 deletions

View File

@ -1,6 +1,5 @@
/node_modules /node_modules
/src /src
/docs
/.github /.github
.gitignore .gitignore
.prettierrc .prettierrc

View File

@ -4,8 +4,6 @@
YouTube Music API (Unofficial) is a YouTube Music data scraper. It comes with TypeScript support API for return types. The NPM package can be found [here](https://npmjs.com/package/ytmusic-api) YouTube Music API (Unofficial) is a YouTube Music data scraper. It comes with TypeScript support API for return types. The NPM package can be found [here](https://npmjs.com/package/ytmusic-api)
**Full documentation is available [here](http://ytmusic-api.zectan.com).**
## Motivation ## Motivation
I used to use [youtube-music-api](https://npmjs.com/package/youtube-music-api) as my youtube music api data scraper. I liked looking into the source code of how it works but it never made sense to me. I also didn't like that there were no TypeScript annotations for the return types of methods. I used to use [youtube-music-api](https://npmjs.com/package/youtube-music-api) as my youtube music api data scraper. I liked looking into the source code of how it works but it never made sense to me. I also didn't like that there were no TypeScript annotations for the return types of methods.
@ -22,6 +20,20 @@ Because of this, I decided to build my own version of a youtube music api with T
- Artists - Artists
- Albums - Albums
- Playlists - Playlists
- Lyrics
## Usage
```js
import YTMusic from "ytmusic-api"
const ytmusic = new YTMusic()
await ytmusic.initialize(/* Optional: Custom cookies */)
ytmusic.search("Never gonna give you up").then(songs => {
console.log(songs)
})
```
## Credits ## Credits
@ -29,38 +41,27 @@ A lot of the credit should go to [youtube-music-api](https://npmjs.com/package/y
## Testing ## Testing
YTMusic API's data return types are tested with Mocha. To run the tests, run the command YTMusic API's data return types are tested with Bun Test. To run the tests, run the command
``` ```
$ npm run test $ bun test
``` ```
## Built with ## Built with
- NodeJS - NodeJS
- TypeScript - TypeScript
- [![@types/json-schema](https://img.shields.io/badge/%40types%2Fjson--schema-%5E7.0.11-red?style=flat-square)](https://npmjs.com/package/@types/json-schema/v/7.0.11)
- [![@types/mocha](https://img.shields.io/badge/%40types%2Fmocha-%5E10.0.1-red?style=flat-square)](https://npmjs.com/package/@types/mocha/v/10.0.1)
- [![@types/node](https://img.shields.io/badge/%40types%2Fnode-%5E18.11.17-red?style=flat-square)](https://npmjs.com/package/@types/node/v/18.11.17)
- [![@types/tough-cookie](https://img.shields.io/badge/%40types%2Ftough--cookie-%5E4.0.2-red?style=flat-square)](https://npmjs.com/package/@types/tough-cookie/v/4.0.2) - [![@types/tough-cookie](https://img.shields.io/badge/%40types%2Ftough--cookie-%5E4.0.2-red?style=flat-square)](https://npmjs.com/package/@types/tough-cookie/v/4.0.2)
- [![@typescript-eslint/eslint-plugin](https://img.shields.io/badge/%40typescript--eslint%2Feslint--plugin-latest-red?style=flat-square)](https://npmjs.com/package/@typescript-eslint/eslint-plugin/v/latest) - [![@typescript-eslint/eslint-plugin](https://img.shields.io/badge/%40typescript--eslint%2Feslint--plugin-latest-red?style=flat-square)](https://npmjs.com/package/@typescript-eslint/eslint-plugin/v/latest)
- [![@typescript-eslint/parser](https://img.shields.io/badge/%40typescript--eslint%2Fparser-latest-red?style=flat-square)](https://npmjs.com/package/@typescript-eslint/parser/v/latest) - [![@typescript-eslint/parser](https://img.shields.io/badge/%40typescript--eslint%2Fparser-latest-red?style=flat-square)](https://npmjs.com/package/@typescript-eslint/parser/v/latest)
- [![ts-node](https://img.shields.io/badge/ts--node-%5E10.9.1-red?style=flat-square)](https://npmjs.com/package/ts-node/v/10.9.1) - [![bun-types](https://img.shields.io/badge/bun--types-%5E1.0.18--1-red?style=flat-square)](https://npmjs.com/package/bun-types/v/1.0.18-1)
- [![typescript](https://img.shields.io/badge/typescript-latest-red?style=flat-square)](https://npmjs.com/package/typescript/v/latest) - [![typescript](https://img.shields.io/badge/typescript-latest-red?style=flat-square)](https://npmjs.com/package/typescript/v/latest)
- Mocha
- [![mocha](https://img.shields.io/badge/mocha-%5E10.2.0-red?style=flat-square)](https://npmjs.com/package/mocha/v/10.2.0)
- [![mocha.parallel](https://img.shields.io/badge/mocha.parallel-%5E0.15.6-red?style=flat-square)](https://npmjs.com/package/mocha.parallel/v/0.15.6)
- [![ts-mocha](https://img.shields.io/badge/ts--mocha-%5E10.0.0-red?style=flat-square)](https://npmjs.com/package/ts-mocha/v/10.0.0)
- VuePress
- [![@vuepress/plugin-search](https://img.shields.io/badge/%40vuepress%2Fplugin--search-%5E2.0.0--beta.46-red?style=flat-square)](https://npmjs.com/package/@vuepress/plugin-search/v/2.0.0-beta.46)
- [![vuepress](https://img.shields.io/badge/vuepress-%5E2.0.0--beta.46-red?style=flat-square)](https://npmjs.com/package/vuepress/v/2.0.0-beta.46)
- ESLint - ESLint
- [![eslint](https://img.shields.io/badge/eslint-latest-red?style=flat-square)](https://npmjs.com/package/eslint/v/latest) - [![eslint](https://img.shields.io/badge/eslint-latest-red?style=flat-square)](https://npmjs.com/package/eslint/v/latest)
- [![eslint-config-prettier](https://img.shields.io/badge/eslint--config--prettier-latest-red?style=flat-square)](https://npmjs.com/package/eslint-config-prettier/v/latest) - [![eslint-config-prettier](https://img.shields.io/badge/eslint--config--prettier-latest-red?style=flat-square)](https://npmjs.com/package/eslint-config-prettier/v/latest)
- [![eslint-plugin-simple-import-sort](https://img.shields.io/badge/eslint--plugin--simple--import--sort-latest-red?style=flat-square)](https://npmjs.com/package/eslint-plugin-simple-import-sort/v/latest) - [![eslint-plugin-simple-import-sort](https://img.shields.io/badge/eslint--plugin--simple--import--sort-latest-red?style=flat-square)](https://npmjs.com/package/eslint-plugin-simple-import-sort/v/latest)
- [![prettier](https://img.shields.io/badge/prettier-latest-red?style=flat-square)](https://npmjs.com/package/prettier/v/latest) - [![prettier](https://img.shields.io/badge/prettier-latest-red?style=flat-square)](https://npmjs.com/package/prettier/v/latest)
- Miscellaneous - Miscellaneous
- [![arktype](https://img.shields.io/badge/arktype-%5E1.0.28--alpha-red?style=flat-square)](https://npmjs.com/package/arktype/v/1.0.28-alpha)
- [![axios](https://img.shields.io/badge/axios-%5E0.27.2-red?style=flat-square)](https://npmjs.com/package/axios/v/0.27.2) - [![axios](https://img.shields.io/badge/axios-%5E0.27.2-red?style=flat-square)](https://npmjs.com/package/axios/v/0.27.2)
- [![tough-cookie](https://img.shields.io/badge/tough--cookie-%5E4.1.2-red?style=flat-square)](https://npmjs.com/package/tough-cookie/v/4.1.2) - [![tough-cookie](https://img.shields.io/badge/tough--cookie-%5E4.1.2-red?style=flat-square)](https://npmjs.com/package/tough-cookie/v/4.1.2)
- [![zod](https://img.shields.io/badge/zod-%5E3.20.2-red?style=flat-square)](https://npmjs.com/package/zod/v/3.20.2)
- [![zod-to-json-schema](https://img.shields.io/badge/zod--to--json--schema-%5E3.20.1-red?style=flat-square)](https://npmjs.com/package/zod-to-json-schema/v/3.20.1)

BIN
bun.lockb

Binary file not shown.

View File

@ -1,253 +0,0 @@
import { defaultTheme, defineUserConfig } from "vuepress"
const { searchPlugin } = require("@vuepress/plugin-search")
export default defineUserConfig({
title: "YTMusic API",
description: "Unofficial YouTube Music API for TypeScript",
plugins: [
searchPlugin({
locales: {
"/": {
placeholder: "Search"
}
}
})
],
theme: defaultTheme({
repo: "zS1L3NT/ts-npm-ytmusic-api",
editLink: false,
navbar: [
{
text: "Home",
link: "/"
},
{
text: "Guides",
link: "/guides/getting-started.html"
},
{
text: "References",
link: "/references/ytmusic.html"
}
],
sidebar: [
{
text: "Guides",
collapsible: true,
children: [
{
text: "Getting Started",
link: "/guides/getting-started.html"
},
{
text: "Usage",
link: "/guides/usage.html",
children: [
{
text: "Getting search suggestions",
link: "/guides/usage/getSearchSuggestions.html"
},
{
text: "Searching for results",
link: "/guides/usage/search.html"
},
{
text: "Searching for songs",
link: "/guides/usage/searchSongs.html"
},
{
text: "Searching for videos",
link: "/guides/usage/searchVideos.html"
},
{
text: "Searching for artists",
link: "/guides/usage/searchArtists.html"
},
{
text: "Searching for albums",
link: "/guides/usage/searchAlbums.html"
},
{
text: "Searching for playlists",
link: "/guides/usage/searchPlaylists.html"
},
{
text: "Getting a song",
link: "/guides/usage/getSong.html"
},
{
text: "Getting a video",
link: "/guides/usage/getVideo.html"
},
{
text: "Getting an artist",
link: "/guides/usage/getArtist.html"
},
{
text: "Getting an artist's top songs",
link: "/guides/usage/getArtistSongs.html"
},
{
text: "Getting an artist's top albums",
link: "/guides/usage/getArtistAlbums.html"
},
{
text: "Getting an album",
link: "/guides/usage/getAlbum.html"
},
{
text: "Getting a playlist",
link: "/guides/usage/getPlaylist.html"
},
{
text: "Getting a playlist's videos",
link: "/guides/usage/getPlaylistVideos.html"
}
]
}
]
},
{
text: "References",
collapsible: true,
children: [
{
text: "YTMusic Class",
link: "/references/ytmusic.html",
children: [
{
text: "getSearchSuggestions",
link: "/references/ytmusic/getSearchSuggestions.html"
},
{
text: "search",
link: "/references/ytmusic/search.html"
},
{
text: "searchSongs",
link: "/references/ytmusic/searchSongs.html"
},
{
text: "searchVideos",
link: "/references/ytmusic/searchVideos.html"
},
{
text: "searchArtists",
link: "/references/ytmusic/searchArtists.html"
},
{
text: "searchAlbums",
link: "/references/ytmusic/searchAlbums.html"
},
{
text: "searchPlaylists",
link: "/references/ytmusic/searchPlaylists.html"
},
{
text: "getSong",
link: "/references/ytmusic/getSong.html"
},
{
text: "getVideo",
link: "/references/ytmusic/getVideo.html"
},
{
text: "getArtist",
link: "/references/ytmusic/getArtist.html"
},
{
text: "getArtistSongs",
link: "/references/ytmusic/getArtistSongs.html"
},
{
text: "getArtistAlbums",
link: "/references/ytmusic/getArtistAlbums.html"
},
{
text: "getAlbum",
link: "/references/ytmusic/getAlbum.html"
},
{
text: "getPlaylist",
link: "/references/ytmusic/getPlaylist.html"
},
{
text: "getPlaylistVideos",
link: "/references/ytmusic/getPlaylistVideos.html"
}
]
},
{
text: "Interfaces",
link: "/references/interfaces.html",
children: [
{
text: "ThumbnailFull",
link: "/references/interfaces/ThumbnailFull.html"
},
{
text: "SongDetailed",
link: "/references/interfaces/SongDetailed.html"
},
{
text: "SongFull",
link: "/references/interfaces/SongFull.html"
},
{
text: "VideoDetailed",
link: "/references/interfaces/VideoDetailed.html"
},
{
text: "VideoFull",
link: "/references/interfaces/VideoFull.html"
},
{
text: "ArtistBasic",
link: "/references/interfaces/ArtistBasic.html"
},
{
text: "ArtistDetailed",
link: "/references/interfaces/ArtistDetailed.html"
},
{
text: "ArtistFull",
link: "/references/interfaces/ArtistFull.html"
},
{
text: "AlbumBasic",
link: "/references/interfaces/AlbumBasic.html"
},
{
text: "AlbumDetailed",
link: "/references/interfaces/AlbumDetailed.html"
},
{
text: "AlbumFull",
link: "/references/interfaces/AlbumFull.html"
},
{
text: "PlaylistDetailed",
link: "/references/interfaces/PlaylistDetailed.html"
},
{
text: "PlaylistFull",
link: "/references/interfaces/PlaylistFull.html"
}
]
},
{
text: "Types",
link: "/references/types.html",
children: [
{
text: "SearchResult",
link: "/references/types/SearchResult.html"
}
]
}
]
}
]
})
})

View File

@ -1,5 +0,0 @@
:root {
scroll-behavior: smooth;
--c-brand: #e6404b !important;
--c-brand-light: #f03441 !important;
}

View File

@ -1,17 +0,0 @@
---
home: true
actions:
- text: Get Started
link: /guides/getting-started.html
type: primary
- text: NPM Registry
link: https://npmjs.org/package/ytmusic-api
type: secondary
features:
- title: YouTube Music Scraper
details: YTMusic API scrapes https://music.youtube.com for results and formats it for you
- title: TypeScript Support
details: You will receive TypeScript annotations when calling YouTube Music API with this package
- title: Type Error Detection
details: If there are type errors at runtime, the bug will be spotted and will show in the console
---

View File

@ -1,41 +0,0 @@
# Getting Started
## Overview
YTMusic API is an npm package that scrapes data from YouTube Music and formats it for you.
## Installation
<CodeGroup>
<CodeGroupItem title="npm" active="true">
```bash:no-line-numbers
npm i ytmusic-api
```
</CodeGroupItem>
<CodeGroupItem title="yarn">
```bash:no-line-numbers
yarn add ytmusic-api
```
</CodeGroupItem>
<CodeGroupItem title="pnpm">
```bash:no-line-numbers
pnpm i ytmusic-api
```
</CodeGroupItem>
</CodeGroup>
## Importing
```ts
// ES6 Import
import YTMusic from "ytmusic-api"
// Node Require
const YTMusic = require("ytmusic-api").default
```

View File

@ -1,28 +0,0 @@
# Usage
YTMusic provides you with 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().initialize()
// Use API here
```
## Custom Cookies
If you want to use your own cookies for all requests, you can do so like this
```ts
const ytmusic = await new YTMusic()
.initialize("COOKIES=here; COOKIES=here; COOKIES=here")
```

View File

@ -1,11 +0,0 @@
# Getting an album
`getAlbum()` will fetch you information about a specific album by its ID.
```ts
ytmusic.getAlbum("MPREb_iG5q5DIdhdA").then(album => {
console.log(album)
})
```
See the [reference](../../references/ytmusic/getAlbum.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting an artist
`getArtist()` will fetch you information about a specific artist by its ID.
```ts
ytmusic.getArtist("UCTUR0sVEkD8T5MlSHqgaI_Q").then(artist => {
console.log(artist)
})
```
See the [reference](../../references/ytmusic/getArtist.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting an artist's albums
`getArtistAlbums()` will fetch you information about a specific artist's albums by its ID.
```ts
ytmusic.getArtistAlbums("UCTUR0sVEkD8T5MlSHqgaI_Q").then(artistAlbums => {
console.log(artistAlbums)
})
```
See the [reference](../../references/ytmusic/getArtistAlbums.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting an artist's songs
`getArtistSongs()` will fetch you information about a specific artist's songs by its ID.
```ts
ytmusic.getArtistSongs("UCTUR0sVEkD8T5MlSHqgaI_Q").then(artistSongs => {
console.log(artistSongs)
})
```
See the [reference](../../references/ytmusic/getArtistSongs.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting a playlist
`getPlaylist()` will fetch you information about a specific playlist by its ID.
```ts
ytmusic.getPlaylist("OLAK5uy_nRb467jR73IXKybwzw22_rTYIJ808x4Yc").then(playlist => {
console.log(playlist)
})
```
See the [reference](../../references/ytmusic/getPlaylist.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting a playlist's videos
`getPlaylistVideos()` will fetch you information about a specific playlist's videos by its ID.
```ts
ytmusic.getPlaylistVideos("OLAK5uy_nRb467jR73IXKybwzw22_rTYIJ808x4Yc").then(playlistVideos => {
console.log(playlistVideos)
})
```
See the [reference](../../references/ytmusic/getPlaylistVideos.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting search suggestions
`getSearchSuggestions()` will fetch you a list of search suggestions based on the query
```ts
ytmusic.getSearchSuggestions("Lilac").then(res => {
console.log(res)
})
```
See the [reference](../../references/ytmusic/getSearchSuggestions.html) for information.

View File

@ -1,11 +0,0 @@
# Getting a song
`getSong()` will fetch you information about a specific song by its ID.
```ts
ytmusic.getSong("v7bnOxV4jAc").then(song => {
console.log(song)
})
```
See the [reference](../../references/ytmusic/getSong.html) for more information.

View File

@ -1,11 +0,0 @@
# Getting a video
`getVideo()` will fetch you information about a specific video by its ID.
```ts
ytmusic.getVideo("v7bnOxV4jAc").then(video => {
console.log(video)
})
```
See the [reference](../../references/ytmusic/getVideo.html) for more information.

View File

@ -1,11 +0,0 @@
# Searching for results
`search()` will search YTMusic for any type of result.
```ts
ytmusic.search("Lilac").then(results => {
console.log(results)
})
```
See the [reference](../../references/ytmusic/search.html) for information.

View File

@ -1,11 +0,0 @@
# Searching for albums
`searchAlbums()` will search YTMusic for album results.
```ts
ytmusic.searchAlbums("Lilac").then(albums => {
console.log(albums)
})
```
See the [reference](../../references/ytmusic/searchAlbums.html) for information.

View File

@ -1,11 +0,0 @@
# Searching for artists
`searchArtists()` will search YTMusic for artist results.
```ts
ytmusic.searchArtists("Lilac").then(artists => {
console.log(artists)
})
```
See the [reference](../../references/ytmusic/searchArtists.html) for information.

View File

@ -1,11 +0,0 @@
# Searching for playlists
`searchPlaylists()` will search YTMusic for playlist results.
```ts
ytmusic.searchPlaylists("Lilac").then(playlists => {
console.log(playlists)
})
```
See the [reference](../../references/ytmusic/searchPlaylists.html) for information.

View File

@ -1,11 +0,0 @@
# Searching for songs
`searchSongs()` will search YTMusic for song results.
```ts
ytmusic.searchSongs("Lilac").then(songs => {
console.log(songs)
})
```
See the [reference](../../references/ytmusic/searchSongs.html) for information.

View File

@ -1,11 +0,0 @@
# Searching for songs
`searchVideos()` will search YTMusic for video results.
```ts
ytmusic.searchVideos("Lilac").then(videos => {
console.log(videos)
})
```
See the [reference](../../references/ytmusic/searchVideos.html) for information.

View File

@ -1,15 +0,0 @@
# Interfaces
- [ThumbnailFull](./interfaces/ThumbnailFull.html)
- [SongDetailed](./interfaces/SongDetailed.html)
- [SongFull](./interfaces/SongFull.html)
- [VideoDetailed](./interfaces/VideoDetailed.html)
- [VideoFull](./interfaces/VideoFull.html)
- [ArtistBasic](./interfaces/ArtistBasic.html)
- [ArtistDetailed](./interfaces/ArtistDetailed.html)
- [ArtistFull](./interfaces/ArtistFull.html)
- [AlbumBasic](./interfaces/AlbumBasic.html)
- [AlbumDetailed](./interfaces/AlbumDetailed.html)
- [AlbumFull](./interfaces/AlbumFull.html)
- [PlaylistDetailed](./interfaces/PlaylistDetailed.html)
- [PlaylistFull](./interfaces/PlaylistFull.html)

View File

@ -1,21 +0,0 @@
# AlbumBasic
## Properties
| Name | Data Type | Description |
| :-------- | :-------- | :---------- |
| `albumId` | `string` | Album ID |
| `name` | `string` | Name |
## TypeScript Source Code
```ts
interface AlbumBasic {
albumId: string
name: string
}
```
## Usages
[SongDetailed#album](./SongDetailed.html)

View File

@ -1,39 +0,0 @@
# AlbumDetailed
## Properties
| Name | Data Type | Description |
| :----------- | :---------------------------------------- | :-------------------- |
| `type` | `"ALBUM"` | Type of data |
| `albumId` | `string` | Album ID |
| `playlistId` | `string` | Playlist ID for Album |
| `name` | `string` | Name |
| `artists` | [ArtistBasic](./ArtistBasic.html)`[]` | Creators of the Album |
| `year` | `number \| null` | Year of release |
| `thumbnails` | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface AlbumDetailed {
type: "ALBUM"
albumId: string
playlistId: string
name: string
artists: ArtistBasic[]
year: number | null
thumbnails: ThumbnailFull[]
}
```
## Usages
[ArtistFull#topAlbums](./ArtistFull.html)
[ArtistFull#topSingles](./ArtistFull.html)
[SearchResult](../types/SearchResult.html)
[YTMusic#searchAlbums](../ytmusic/searchAlbums.html)
[YTMusic#getArtistAlbums](../ytmusic/getArtistAlbums.html)

View File

@ -1,35 +0,0 @@
# AlbumFull
## Properties
| Name | Data Type | Description |
| :------------ | :---------------------------------------- | :-------------------- |
| `type` | `"ALBUM"` | Type of data |
| `albumId` | `string` | Album ID |
| `playlistId` | `string` | Playlist ID for Album |
| `name` | `string` | Name |
| `artists` | [ArtistBasic](./ArtistBasic.html)`[]` | Creators of the Album |
| `year` | `number \| null` | Year of release |
| `thumbnails` | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| `description` | `string` | Description |
| `songs` | [SongDetailed](./SongDetailed.html)`[]` | Songs in the Album |
## TypeScript Source Code
```ts
interface AlbumFull {
type: "ALBUM"
albumId: string
playlistId: string
name: string
artists: ArtistBasic[]
year: number | null
thumbnails: ThumbnailFull[]
description: string
songs: SongDetailed[]
}
```
## Usages
[YTMusic#getAlbum](../ytmusic/getAlbum.md)

View File

@ -1,29 +0,0 @@
# ArtistBasic
## Properties
| Name | Data Type | Description |
| :------- | :-------- | :---------- |
| artistId | `string` | Artist ID |
| name | `string` | Name |
## TypeScript Source Code
```ts
interface ArtistBasic {
artistId: string
name: string
}
```
## Usages
[SongDetailed#artists](./SongDetailed.html)
[VideoDetailed#artists](./VideoDetailed.html)
[AlbumDetailed#artists](./AlbumDetailed.html)
[PlaylistDetailed#artist](./PlaylistDetailed.html)
[PlaylistFull#artist](./PlaylistFull.html)

View File

@ -1,27 +0,0 @@
# ArtistDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :----------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface ArtistDetailed {
type: "ARTIST"
artistId: string
name: string
thumbnails: ThumbnailFull[]
}
```
## Usages
[SearchResult](../types/SearchResult.html)
[YTMusic#searchArtists](../ytmusic/searchArtists.html)

View File

@ -1,35 +0,0 @@
# ArtistFull
## Properties
| Name | Data Type | Description |
| :---------- | :---------------------------------------------------------- | :----------------------------------- |
| type | `"ARTIST"` | Type of data |
| artistId | `string` | Artist ID |
| name | `string` | Name |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| topSongs | `Omit<`[SongDetailed](./SongDetailed.html)`, "duration">[]` | Top Songs from Artist |
| topAlbums | [AlbumDetailed](./AlbumDetailed.html)`[]` | Top Albums from Artist |
| topSingles | [AlbumDetailed](./AlbumDetailed.html)`[]` | Top Singles from Artist |
| topVideos | `Omit<`[VideoDetailed](./VideoDetailed.html)`, "duration">[]` | Top Videos from Artist |
## TypeScript Source Code
```ts
interface ArtistFull {
type: "ARTIST"
artistId: string
name: string
thumbnails: ThumbnailFull[]
description: string
topSongs: Omit<SongDetailed, "duration">[]
topAlbums: AlbumDetailed[]
topSingles: AlbumDetailed[]
topVideos: Omit<VideoDetailed, "duration">[]
}
```
## Usages
[YTMusic#getArtist](../ytmusic/getArtist.html)

View File

@ -1,29 +0,0 @@
# PlaylistDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------------------- |
| type | `"PLAYLIST"` | Type of data |
| playlistId | `string` | Playlist ID |
| name | `string` | Name |
| artist | [ArtistBasic](#ArtistBasic) | Creator of the Playlist |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface PlaylistDetailed {
type: "PLAYLIST"
playlistId: string
name: string
artist: ArtistBasic
thumbnails: ThumbnailFull[]
}
```
## Usages
[SearchResult](../types/SearchResult.html)
[YTMusic#searchPlaylists](../ytmusic/searchPlaylists.html)

View File

@ -1,29 +0,0 @@
# PlaylistFull
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------- | :------------------------------- |
| type | `"PLAYLIST"` | Type of data |
| playlistId | `string` | Playlist ID |
| name | `string` | Name |
| artist | [ArtistBasic](#ArtistBasic) | Creator of the Playlist |
| videoCount | `number` | Number of videos in the Playlist |
| thumbnails | [ThumbnailFull](#ThumbnailFull)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface PlaylistFull {
type: "PLAYLIST"
playlistId: string
name: string
artist: ArtistBasic
videoCount: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[YTMusic#getPlaylist](../ytmusic/getPlaylist.html)

View File

@ -1,39 +0,0 @@
# SongDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :------------------ |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Artists |
| album | [AlbumBasic](./AlbumBasic.html) | Album |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface SongDetailed {
type: "SONG"
videoId: string
name: string
artists: ArtistBasic[]
album: AlbumBasic
duration: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[ArtistFull#topSongs](./ArtistFull.html)
[AlbumFull#songs](./AlbumFull.html)
[SearchResult](../types/SearchResult.html)
[YTMusic#searchSongs](../ytmusic/searchSongs.html)
[YTMusic#getArtistSongs](../ytmusic/getArtistSongs.html)

View File

@ -1,35 +0,0 @@
# SongFull
## Properties
| Name | Data Type | Description |
| :-------------- | :---------------------------------------- | :--------------------- |
| type | `"SONG"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Artists |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| formats | `any[]` | Video Formats |
| adaptiveFormats | `any[]` | Adaptive Video Formats |
## TypeScript Source Code
```ts
interface SongFull {
type: "SONG"
videoId: string
name: string
artists: ArtistBasic[]
duration: number
thumbnails: ThumbnailFull[]
description: string
formats: any[]
adaptiveFormats: any[]
}
```
## Usages
[YTMusic#getSong](../ytmusic/getSong.html)

View File

@ -1,33 +0,0 @@
# ThumbnailFull
## Properties
| Name | Data Type | Description |
| :------- | :-------- | :------------------ |
| `url` | `string` | Link |
| `width` | `number` | Width of the image |
| `height` | `number` | Height of the image |
## TypeScript Source Code
```ts
interface ThumbnailFull {
url: string
width: number
height: number
}
```
## Usages
[SongDetailed#thumbnails](./SongDetailed.html)
[VideoDetailed#thumbnails](./VideoDetailed.html)
[ArtistDetailed#thumbnails](./ArtistDetailed.html)
[AlbumDetailed#thumbnails](./AlbumDetailed.html)
[PlaylistDetailed#thumbnails](./PlaylistDetailed.html)
[PlaylistFull#thumbnails](./PlaylistFull.html)

View File

@ -1,35 +0,0 @@
# VideoDetailed
## Properties
| Name | Data Type | Description |
| :--------- | :---------------------------------------- | :------------------------------ |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Channels that created the video |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
## TypeScript Source Code
```ts
interface VideoDetailed {
type: "VIDEO"
videoId: string
name: string
artists: ArtistBasic[]
duration: number
thumbnails: ThumbnailFull[]
}
```
## Usages
[ArtistFull#topVideos](../types/ArtistFull.html)
[SearchResult](../types/SearchResult.html)
[YTMusic#searchVideos](../ytmusic/searchVideos.html)
[YTMusic#getPlaylistVideos](../ytmusic/getPlaylistVideos.html)

View File

@ -1,39 +0,0 @@
# VideoFull
## Properties
| Name | Data Type | Description |
| :---------- | :---------------------------------------- | :------------------------------------- |
| type | `"VIDEO"` | Type of data |
| videoId | `string` | YouTube Video ID |
| name | `string` | Name |
| artists | [ArtistBasic](./ArtistBasic.html)`[]` | Channels that created the video |
| duration | `number` | Duration in seconds |
| thumbnails | [ThumbnailFull](./ThumbnailFull.html)`[]` | Thumbnails |
| description | `string` | Description |
| unlisted | `boolean` | If the video is unlisted on YouTube |
| familySafe | `boolean` | If the video is family safe on YouTube |
| paid | `boolean` | If the video is paid on YouTube |
| tags | `string[]` | Tags |
## TypeScript Source Code
```ts
interface VideoFull {
type: "VIDEO"
videoId: string
name: string
artists: ArtistBasic[]
duration: number
thumbnails: ThumbnailFull[]
description: string
unlisted: boolean
familySafe: boolean
paid: boolean
tags: string[]
}
```
## Usages
[YTMusic#getVideo](../ytmusic/getVideo.html)

View File

@ -1,3 +0,0 @@
# Types
- [SearchResult](../types/SearchResult.html)

View File

@ -1,26 +0,0 @@
# SearchResult
## Value
Either
- [SongDetailed](../interfaces/SongDetailed.html)
- [VideoDetailed](../interfaces/VideoDetailed.html)
- [AlbumDetailed](../interfaces/AlbumDetailed.html)
- [ArtistDetailed](../interfaces/ArtistDetailed.html)
- [PlaylistDetailed](../interfaces/PlaylistDetailed.html)
## TypeScript Source Code
```ts
type SearchResult =
| SongDetailed
| VideoDetailed
| AlbumDetailed
| ArtistDetailed
| PlaylistDetailed
```
## Usages
[YTMusic#search](../ytmusic/search.html)

View File

@ -1,19 +0,0 @@
# YTMusic Class
## Methods
- [getSearchSuggestions](./ytmusic/getSearchSuggestions.html)
- [search](./ytmusic/search.html)
- [searchSongs](./ytmusic/searchSongs.html)
- [searchVideos](./ytmusic/searchVideos.html)
- [searchArtists](./ytmusic/searchArtists.html)
- [searchAlbums](./ytmusic/searchAlbums.html)
- [searchPlaylists](./ytmusic/searchPlaylists.html)
- [getSong](./ytmusic/getSong.html)
- [getVideo](./ytmusic/getVideo.html)
- [getArtist](./ytmusic/getArtist.html)
- [getArtistSongs](./ytmusic/getArtistSongs.html)
- [getArtistAlbums](./ytmusic/getArtistAlbums.html)
- [getAlbum](./ytmusic/getAlbum.html)
- [getPlaylist](./ytmusic/getPlaylist.html)
- [getPlaylistVideos](./ytmusic/getPlaylistVideos.html)

View File

@ -1,19 +0,0 @@
# getAlbum
See the [guide](../../guides/usage/getAlbum.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :-------- | :-------- | :---------- |
| `albumId` | `string` | Album ID |
## Returns
`Promise<`[AlbumFull](../interfaces/AlbumFull.html)`>`
## TypeScript Source Code
```ts
public async getAlbum(albumId: string): Promise<AlbumFull>
```

View File

@ -1,19 +0,0 @@
# getArtist
See the [guide](../../guides/usage/getArtist.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :--------- | :-------- | :---------- |
| `artistId` | `string` | Artist ID |
## Returns
`Promise<`[ArtistFull](../interfaces/ArtistFull.html)`>`
## TypeScript Source Code
```ts
public async getArtist(artistId: string): Promise<ArtistFull>
```

View File

@ -1,19 +0,0 @@
# getArtistAlbums
See the [guide](../../guides/usage/getArtistAlbums.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :--------- | :-------- | :---------- |
| `artistId` | `string` | Artist ID |
## Returns
`Promise<`[AlbumDetailed](../interfaces/AlbumDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async getArtistAlbums(artistId: string): Promise<AlbumDetailed[]>
```

View File

@ -1,19 +0,0 @@
# getArtistSongs
See the [guide](../../guides/usage/getArtistSongs.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :--------- | :-------- | :---------- |
| `artistId` | `string` | Artist ID |
## Returns
`Promise<`[SongDetailed](../interfaces/SongDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async getArtistSongs(artistId: string): Promise<SongDetailed[]>
```

View File

@ -1,19 +0,0 @@
# getPlaylist
See the [guide](../../guides/usage/getPlaylist.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :----------- | :-------- | :---------- |
| `playlistId` | `string` | Playlist ID |
## Returns
`Promise<`[PlaylistFull](../interfaces/PlaylistFull.html)`>`
## TypeScript Source Code
```ts
public async getPlaylist(playlistId: string): Promise<PlaylistFull>
```

View File

@ -1,19 +0,0 @@
# getPlaylistVideos
See the [guide](../../guides/usage/getPlaylistVideos.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :----------- | :-------- | :---------- |
| `playlistId` | `string` | Playlist ID |
## Returns
`Promise<`[VideoDetailed](../interfaces/VideoDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async getPlaylistVideos(playlistId: string): Promise<VideoDetailed[]>
```

View File

@ -1,19 +0,0 @@
# getSearchSuggestions
See the [guide](../../guides/usage/getSearchSuggestions.html) for information on how to use this.
## Parameters
| Name | Data Type | Description |
| :---- | :-------- | :------------------------------------ |
| query | string | Search query you want suggestions for |
## Returns
`Promise<string[]>`
## TypeScript Source Code
```ts
public async getSearchSuggestions(query: string): Promise<string[]>
```

View File

@ -1,19 +0,0 @@
# getSong
See the [guide](../../guides/usage/getSong.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :-------- | :-------- | :---------- |
| `videoId` | `string` | Video ID |
## Returns
`Promise<`[SongFull](../interfaces/SongFull.html)`>`
## TypeScript Source Code
```ts
public async getSong(videoId: string): Promise<SongFull>
```

View File

@ -1,19 +0,0 @@
# getVideo
See the [guide](../../guides/usage/getVideo.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :-------- | :-------- | :---------- |
| `videoId` | `string` | Video ID |
## Returns
`Promise<`[VideoFull](../interfaces/VideoFull.html)`>`
## TypeScript Source Code
```ts
public async getVideo(videoId: string): Promise<VideoFull>
```

View File

@ -1,19 +0,0 @@
# search
See the [guide](../../guides/usage/search.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[SearchResult](../types/SearchResult.html)`[]>`
## TypeScript Source Code
```ts
public async search(query: string): Promise<SearchResult[]>
```

View File

@ -1,19 +0,0 @@
# searchAlbums
See the [guide](../../guides/usage/searchAlbums.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[AlbumDetailed](../interfaces/AlbumDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async searchAlbums(query: string): Promise<AlbumDetailed[]>
```

View File

@ -1,19 +0,0 @@
# searchArtists
See the [guide](../../guides/usage/searchArtists.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[ArtistDetailed](../interfaces/ArtistDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async searchArtists(query: string): Promise<ArtistDetailed[]>
```

View File

@ -1,19 +0,0 @@
# searchPlaylists
See the [guide](../../guides/usage/searchPlaylists.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[PlaylistDetailed](../interfaces/PlaylistDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async searchPlaylists(query: string): Promise<PlaylistDetailed[]>
```

View File

@ -1,19 +0,0 @@
# searchSongs
See the [guide](../../guides/usage/searchSongs.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[SongDetailed](../interfaces/SongDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async searchSongs(query: string): Promise<SongDetailed[]>
```

View File

@ -1,19 +0,0 @@
# searchVideos
See the [guide](../../guides/usage/searchVideos.html) for information on how to use this.
## Properties
| Name | Data Type | Description |
| :------ | :-------- | :----------- |
| `query` | `string` | Search query |
## Returns
`Promise<`[VideoDetailed](../interfaces/VideoDetailed.html)`[]>`
## TypeScript Source Code
```ts
public async searchVideos(query: string): Promise<VideoDetailed[]>
```

View File

@ -1,6 +1,6 @@
{ {
"name": "ytmusic-api", "name": "ytmusic-api",
"version": "4.5.0", "version": "5.0.0",
"description": "YouTube Music API", "description": "YouTube Music API",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",
@ -12,8 +12,6 @@
}, },
"scripts": { "scripts": {
"build": "tsc", "build": "tsc",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs",
"clean": "tsc --noEmit && eslint src --fix && prettier src --write && rm tsconfig.tsbuildinfo" "clean": "tsc --noEmit && eslint src --fix && prettier src --write && rm tsconfig.tsbuildinfo"
}, },
"dependencies": { "dependencies": {
@ -25,14 +23,12 @@
"@types/tough-cookie": "^4.0.2", "@types/tough-cookie": "^4.0.2",
"@typescript-eslint/eslint-plugin": "latest", "@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest", "@typescript-eslint/parser": "latest",
"@vuepress/plugin-search": "^2.0.0-beta.46",
"bun-types": "^1.0.18-1", "bun-types": "^1.0.18-1",
"eslint": "latest", "eslint": "latest",
"eslint-config-prettier": "latest", "eslint-config-prettier": "latest",
"eslint-plugin-simple-import-sort": "latest", "eslint-plugin-simple-import-sort": "latest",
"prettier": "latest", "prettier": "latest",
"typescript": "latest", "typescript": "latest"
"vuepress": "^2.0.0-beta.46"
}, },
"keywords": [ "keywords": [
"youtube", "youtube",