From 27a50a2a7e959ff0c2af6b2027b8f50036e660cf Mon Sep 17 00:00:00 2001 From: LuanRT Date: Thu, 16 Feb 2023 18:38:10 -0300 Subject: [PATCH] docs: add documentation for `Feed`, `FilterableFeed` and `TabbedFeed` --- README.md | 71 ++++++++++++++-------- docs/API/feed.md | 115 ++++++++++++++++++++++++++++++++++++ docs/API/filterable-feed.md | 38 ++++++++++++ docs/API/tabbed-feed.md | 62 +++++++++++++++++++ 4 files changed, 260 insertions(+), 26 deletions(-) create mode 100644 docs/API/feed.md create mode 100644 docs/API/filterable-feed.md create mode 100644 docs/API/tabbed-feed.md diff --git a/README.md b/README.md index 53ed01cc..180e71aa 100644 --- a/README.md +++ b/README.md @@ -267,7 +267,7 @@ const yt = await Innertube.create({ Retrieves video info, including playback data and even layout elements such as menus, buttons, etc — all nicely parsed. -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -284,7 +284,7 @@ Retrieves video info, including playback data and even layout elements such as m - `#dislike()` - Dislikes the video. -- `#removeLike()` +- `#removeRating()` - Removes like/dislike. - `#getLiveChat()` @@ -322,7 +322,7 @@ Retrieves video info, including playback data and even layout elements such as m Suitable for cases where you only need basic video metadata. Also, it is faster than [`getInfo()`](#getinfo). -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -334,7 +334,10 @@ Suitable for cases where you only need basic video metadata. Also, it is faster Searches the given query on YouTube. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `Search` extends the [`Feed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/feed.md) class. | Param | Type | Description | | --- | --- | --- | @@ -361,7 +364,7 @@ Searches the given query on YouTube. ### getSearchSuggestions(query) Retrieves search suggestions for given query. -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -371,7 +374,7 @@ Retrieves search suggestions for given query. ### getComments(video_id, sort_by?) Retrieves comments for given video. -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -384,7 +387,10 @@ See [`./examples/comments`](https://github.com/LuanRT/YouTube.js/blob/main/examp ### getHomeFeed() Retrieves YouTube's home feed. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `HomeFeed` extends the [`FilterableFeed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/filterable-feed.md) class.
Methods & Getters @@ -415,7 +421,10 @@ Retrieves YouTube's home feed. ### getLibrary() Retrieves the account's library. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `Library` extends the [`Feed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/feed.md) class.
Methods & Getters @@ -424,10 +433,8 @@ Retrieves the account's library. - `#history` - `#watch_later` - `#liked_videos` -- `#playlists` +- `#playlists_section` - `#clips` -- `#page` - - Returns original InnerTube response (sanitized).

@@ -436,7 +443,10 @@ Retrieves the account's library. ### getHistory() Retrieves watch history. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `History` extends the [`Feed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/feed.md) class.
Methods & Getters @@ -452,19 +462,22 @@ Retrieves watch history. ### getTrending() Retrieves trending content. -**Returns**: `Promise.>` +**Returns**: `Promise>` ### getSubscriptionsFeed() -Retrieves subscriptions feed. +Retrieves the subscriptions feed. -**Returns**: `Promise.>` +**Returns**: `Promise>` ### getChannel(id) Retrieves contents for a given channel. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `Channel` extends the [`TabbedFeed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/tabbed-feed.md) class. | Param | Type | Description | | --- | --- | --- | @@ -501,7 +514,7 @@ See [`./examples/channel`](https://github.com/LuanRT/YouTube.js/blob/main/exampl ### getNotifications() Retrieves notifications. -**Returns**: `Promise.` +**Returns**: `Promise`
Methods & Getter @@ -517,13 +530,16 @@ Retrieves notifications. ### getUnseenNotificationsCount() Retrieves unseen notifications count. -**Returns**: `Promise.` +**Returns**: `Promise` ### getPlaylist(id) Retrieves playlist contents. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `Playlist` extends the [`Feed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/feed.md) class. | Param | Type | Description | | --- | --- | --- | @@ -543,7 +559,10 @@ Retrieves playlist contents. ### getHashtag(hashtag) Retrieves a given hashtag's page. -**Returns**: `Promise.` +**Returns**: `Promise` + +> **Note** +> `HashtagFeed` extends the [`FilterableFeed`](https://github.com/LuanRT/YouTube.js/blob/main/docs/API/filterable-feed.md) class. | Param | Type | Description | | --- | --- | --- | @@ -565,15 +584,15 @@ Retrieves a given hashtag's page. ### getStreamingData(video_id, options) Returns deciphered streaming data. -**Note:** -It is recommended to retrieve streaming data from a `VideoInfo`/`TrackInfo` object instead if you want to select formats manually, example: +**Note** +This will be deprecated in the future. It is recommended to retrieve streaming data from a `VideoInfo`/`TrackInfo` object instead if you want to select formats manually, example: ```ts const info = await yt.getBasicInfo('somevideoid'); const url = info.streaming_data?.formats[0].decipher(yt.session.player); console.info('Playback url:', url); ``` -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -584,7 +603,7 @@ console.info('Playback url:', url); ### download(video_id, options?) Downloads a given video. -**Returns**: `Promise.>` +**Returns**: `Promise>` | Param | Type | Description | | --- | --- | --- | @@ -597,7 +616,7 @@ See [`./examples/download`](https://github.com/LuanRT/YouTube.js/blob/main/examp ### resolveURL(url) Resolves a given url. -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | @@ -607,7 +626,7 @@ Resolves a given url. ### call(endpoint, args?) Utility to call navigation endpoints. -**Returns**: `Promise.` +**Returns**: `Promise` | Param | Type | Description | | --- | --- | --- | diff --git a/docs/API/feed.md b/docs/API/feed.md new file mode 100644 index 00000000..13c7e4b3 --- /dev/null +++ b/docs/API/feed.md @@ -0,0 +1,115 @@ +# Feed + +Represents a YouTube feed. This class provides a set of utility methods for parsing and interacting with feeds. + +## API + +* Feed + * [.videos](#videos) + * [.posts](#posts) + * [.channels](#channels) + * [.playlists](#playlists) + * [.shelves](#shelves) + * [.memo](#memo) + * [.page_contents](#page_contents) + * [.secondary_contents](#secondary_contents) + * [.page](#page) + * [.has_continuation](#has_continuation) + * [.getContinuationData()](#getcontinuationdata) + * [.getContinuation()](#getcontinuation) + * [.getShelf(title)](#getshelf) + + +### videos + +Returns all videos in the feed. + +**Returns:** `ObservedArray