Basic vuepress@1.9.7

This commit is contained in:
Zechariah Tan 2022-03-29 13:23:17 +08:00
parent 14a4f1a12c
commit 7be05d30d8
7 changed files with 8280 additions and 45 deletions

View File

@ -5,6 +5,7 @@
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)
## 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.
Because of this, I decided to build my own version of a youtube music api with TypeScript annotations, testing and written in a way I can understand.
@ -20,34 +21,6 @@ Because of this, I decided to build my own version of a youtube music api with T
- Albums
- Playlists
## Installation
```
$ npm i ytmusic-api
```
## Usage
Import YTMusic from the npm package
```ts
// TypeScript
import YTMusic from "ytmusic-api"
// JavaScript
const YTMusic = require("ytmusic-api")
```
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
})
```
### Methods to fetch data
#### `getSearchSuggestions`
@ -339,7 +312,7 @@ ytmusic.getPlaylistVideos("OLAK5uy_nRb467jR73IXKybwzw22_rTYIJ808x4Yc").then(play
#### `ArtistBasic`
| Name | Data Type | Description |
| :------- | :--------------- | :---------- |
| :------- | :-------- | :---------- |
| artistId | `string` | Artist ID |
| name | `string` | Name |
@ -414,6 +387,7 @@ ytmusic.getPlaylistVideos("OLAK5uy_nRb467jR73IXKybwzw22_rTYIJ808x4Yc").then(play
[SongDetailed](#SongDetailed) or [VideoDetailed](#VideoDetailed) or [ArtistDetailed](#ArtistDetailed) or [AlbumDetailed](#AlbumDetailed) or [PlaylistFull](#PlaylistFull)
## Credits
A lot of the credit should go to [youtube-music-api](https://npmjs.com/package/youtube-music-api). I build this package as a refactored and tested version of youtube-music-api with TypeScript annotations
## Testing

29
docs/.vuepress/config.ts Normal file
View File

@ -0,0 +1,29 @@
import { defineConfig } from "vuepress/config"
export default defineConfig({
title: "YTMusic API",
description: "Unofficial YouTube Music API for TypeScript",
themeConfig: {
repo: "zS1L3NT/ts-npm-ytmusic-api",
searchPlaceholder: "Search",
smoothScroll: true,
//@ts-ignore
displayAllHeaders: true,
activeHeaderLinks: true,
nav: [
{ text: "Home", link: "/" },
{ text: "Docs", link: "/docs/getting-started.html" }
],
sidebar: [
{
title: "Documentation",
collapsable: false,
sidebarDepth: 2,
children: [
["/docs/getting-started", "Getting Started"],
["/docs/references", "References"]
]
}
]
}
})

12
docs/README.md Normal file
View File

@ -0,0 +1,12 @@
---
home: true
actionText: Get Started
actionLink: /docs/getting-started.html
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

@ -0,0 +1,49 @@
# Getting Started
## Overview
YTMusic API is an npm package that scrapes data from YouTube Music and formats it for you.
## Installation
<code-group>
<code-block title="npm">
```bash
npm i ytmusic-api
```
</code-block>
<code-block title="yarn">
```bash
yarn add ytmusic-api
```
</code-block>
<code-block title="pnpm">
```bash
pnpm i ytmusic-api
```
</code-block>
</code-group>
## Usage
Import YTMusic from the npm package
```ts
// ES6 Import
import YTMusic from "ytmusic-api"
// Node Require
const YTMusic = require("ytmusic-api")
```
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
})
```

49
docs/docs/references.md Normal file
View File

@ -0,0 +1,49 @@
# References
## `YTMusic` methods
### `getSearchSuggestions`
### `search`
### `getSong`
### `getVideo`
### `getArtist`
### `getArtistVideo`
### `getArtistAlbums`
### `getAlbum`
### `getPlaylist`
### `getPlaylistVideos`
## Interfaces
### `ThumbnailFull`
### `SongDetailed`
### `SongFull`
### `VideoDetailed`
### `VideoFull`
### `ArtistBasic`
### `ArtistDetailed`
### `ArtistFull`
### `AlbumBasic`
### `AlbumDetailed`
### `AlbumFull`
### `PlaylistFull`

View File

@ -11,7 +11,9 @@
"url": "https://github.com/zS1L3NT/ts-npm-ytmusic-api"
},
"scripts": {
"test": "ts-mocha --timeout 10000 src/__tests__/**/*.spec.ts"
"test": "ts-mocha --timeout 10000 src/__tests__/**/*.spec.ts",
"docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs"
},
"dependencies": {
"axios": "^0.25.0",
@ -25,7 +27,9 @@
"mocha": "^9.2.2",
"mocha.parallel": "^0.15.6",
"ts-mocha": "^9.0.2",
"typescript": "^4.5.5"
"typescript": "^4.5.5",
"validate-any": "1.3.1",
"vuepress": "^1.9.7"
},
"keywords": [
"youtube",

File diff suppressed because it is too large Load Diff