Compare commits

..

15 Commits

Author SHA1 Message Date
github-actions[bot]
197bb759cd chore(main): release 3.2.0 (#334)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-08 07:20:21 -03:00
LuanRT
c76b24b3f4 chore(parser): import YTNodes directly to reduce web bundle size 2023-03-08 07:18:01 -03:00
absidue
574b67a1f7 feat: Add support for descriptive audio tracks (#338) 2023-03-08 05:36:01 -03:00
LuanRT
9b2738f128 fix(SegmentedLikeDislikeButton): like/dislike buttons can also be a simple Button 2023-03-07 05:43:32 -03:00
LuanRT
95f1d4077f fix(YouTube): fix warnings when retrieving members-only content (#341) 2023-03-07 05:15:46 -03:00
LuanRT
a511608f18 feat(YouTube/Search): add SearchSubMenu node (#340) 2023-03-07 04:17:58 -03:00
LuanRT
cf8a33c79f fix(ytmusic): export search filters type 2023-03-07 03:02:44 -03:00
Chinmay Kumar
cfc1a183e0 refactor(parser): type YTNodes' data arg as RawNode (wip) (#339)
* replaced YTNode's data arg as RawNode

* updated documentation

* removed unused import

---- Note that there are still many nodes that need to be updated, hence the WIP status.
2023-03-07 02:02:07 -03:00
Patrick Kan
95033e723e feat(parser): add banner to PlaylistHeader (#337) 2023-03-05 22:44:09 -03:00
Patrick Kan
2cc7b8bcd6 feat(yt): add getGuide() (#335)
* feat(yt): add `getGuide()`

* chore: lint

* fix(Guide): wrong prop

* fix(Guide): include subscription section

* fix(Guide): wrong import

* feat(Guide): add `page`
2023-03-04 06:23:17 -03:00
LuanRT
2d774e26aa feat: export FormatUtils' types 2023-03-04 04:06:19 -03:00
Nico K
214aa147ce feat(VideoInfo): add game_info and category (#333) 2023-03-03 03:47:20 -03:00
Daniel Wykerd
ce53ac1843 feat(parser): SharedPost (#332)
Add support for SharedPost in community tab.
Related to issue #331
2023-03-03 03:41:04 -03:00
github-actions[bot]
0ad26f28d9 chore(main): release 3.1.1 (#330)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-03-01 16:30:10 -03:00
ChunkyProgrammer
4c7b8a3403 fix(Channel): getting community continuations (#329) 2023-03-01 16:28:26 -03:00
124 changed files with 744 additions and 194 deletions

View File

@@ -1,5 +1,32 @@
# Changelog
## [3.2.0](https://github.com/LuanRT/YouTube.js/compare/v3.1.1...v3.2.0) (2023-03-08)
### Features
* Add support for descriptive audio tracks ([#338](https://github.com/LuanRT/YouTube.js/issues/338)) ([574b67a](https://github.com/LuanRT/YouTube.js/commit/574b67a1f707a32378586dd2fe7b2f36f4ab6ddb))
* export `FormatUtils`' types ([2d774e2](https://github.com/LuanRT/YouTube.js/commit/2d774e26aae79f3d1b115e0e85c148ae80985529))
* **parser:** add `banner` to `PlaylistHeader` ([#337](https://github.com/LuanRT/YouTube.js/issues/337)) ([95033e7](https://github.com/LuanRT/YouTube.js/commit/95033e723ef912706e4d176de6b2760f017184e1))
* **parser:** SharedPost ([#332](https://github.com/LuanRT/YouTube.js/issues/332)) ([ce53ac1](https://github.com/LuanRT/YouTube.js/commit/ce53ac18435cbcb20d6d4c4ab52fd156091e7592))
* **VideoInfo:** add `game_info` and `category` ([#333](https://github.com/LuanRT/YouTube.js/issues/333)) ([214aa14](https://github.com/LuanRT/YouTube.js/commit/214aa147ce6306e37a6bf860a7bed5635db4797e))
* **YouTube/Search:** add `SearchSubMenu` node ([#340](https://github.com/LuanRT/YouTube.js/issues/340)) ([a511608](https://github.com/LuanRT/YouTube.js/commit/a511608f18b37b0d9f2c7958ed5128330fabcfa0))
* **yt:** add `getGuide()` ([#335](https://github.com/LuanRT/YouTube.js/issues/335)) ([2cc7b8b](https://github.com/LuanRT/YouTube.js/commit/2cc7b8bcd6938c7fb3af4f854a1d78b86d153873))
### Bug Fixes
* **SegmentedLikeDislikeButton:** like/dislike buttons can also be a simple `Button` ([9b2738f](https://github.com/LuanRT/YouTube.js/commit/9b2738f1285b278c3e83541857651be9a6248288))
* **YouTube:** fix warnings when retrieving members-only content ([#341](https://github.com/LuanRT/YouTube.js/issues/341)) ([95f1d40](https://github.com/LuanRT/YouTube.js/commit/95f1d4077ff3775f36967dca786139a09e2830a2))
* **ytmusic:** export search filters type ([cf8a33c](https://github.com/LuanRT/YouTube.js/commit/cf8a33c79f5432136b865d535fd0ecedc2393382))
## [3.1.1](https://github.com/LuanRT/YouTube.js/compare/v3.1.0...v3.1.1) (2023-03-01)
### Bug Fixes
* **Channel:** getting community continuations ([#329](https://github.com/LuanRT/YouTube.js/issues/329)) ([4c7b8a3](https://github.com/LuanRT/YouTube.js/commit/4c7b8a34030effa26c4ea186d3e9509128aec31c))
## [3.1.0](https://github.com/LuanRT/YouTube.js/compare/v3.0.0...v3.1.0) (2023-02-26)

View File

@@ -254,6 +254,7 @@ const yt = await Innertube.create({
* [.getSearchSuggestions(query)](#getsearchsuggestions)
* [.getComments(video_id, sort_by?)](#getcomments)
* [.getHomeFeed()](#gethomefeed)
* [.getGuide()](#getguide)
* [.getLibrary()](#getlibrary)
* [.getHistory()](#gethistory)
* [.getTrending()](#gettrending)
@@ -426,6 +427,12 @@ Retrieves YouTube's home feed.
</p>
</details>
<a name="getguide"></a>
### getGuide()
Retrieves YouTube's content guide.
**Returns**: `Promise<Guide>`
<a name="getlibrary"></a>
### getLibrary()
Retrieves the account's library.

View File

@@ -1,8 +1,9 @@
# Updating the parser
YouTube is constantly changing, so it is not rare to see YouTube crawlers/scrapers breaking every now and then.
YouTube is constantly changing, so it is not rare to see YouTube crawlers/scrapers breaking every now and then.
Our parser, on the other hand, was written so that it behaves similarly to an official client, parsing and mapping renderers (a.k.a YTNodes) dynamically without hard-coding their path in the response. This way, whenever a new renderer pops up (e.g; YouTube adds a new feature / minor UI changes) the library will print a warning similar to this:
Our parser, on the other hand, was written so that it behaves similarly to an official client, parsing and mapping renderers (a.k.a YTNodes) dynamically without hard-coding their path in the response. This way, whenever a new renderer pops up (e.g; YouTube adds a new feature / minor UI changes) the library will print a warning similar to this:
```
InnertubeError: SomeRenderer not found!
This is a bug, want to help us fix it? Follow the instructions at https://github.com/LuanRT/YouTube.js/blob/main/docs/updating-the-parser.md or report it at https://github.com/LuanRT/YouTube.js/issues!
@@ -26,17 +27,19 @@ Thanks to the modularity of the parser, a renderer can be implemented by simply
For example, say we found a new renderer named `verticalListRenderer`, to let the parser know it exists we would have to create a file with the following structure:
> `../classes/VerticalList.ts`
```ts
import Parser from '..';
import { YTNode } from '../helpers';
import type { RawNode } from '../index.js';
class VerticalList extends YTNode {
static type = 'VerticalList';
header;
contents;
constructor(data: any) {
constructor(data: RawNode) {
// parse the data here, ex;
this.header = Parser.parseItem(data.header);
this.contents = Parser.parseArray(data.contents);
@@ -47,8 +50,9 @@ export default VerticalList;
```
Then update the parser map:
```bash
npm run build:parser-map
```
And that's it!
And that's it!

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "youtubei.js",
"version": "3.1.0",
"version": "3.2.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "youtubei.js",
"version": "3.1.0",
"version": "3.2.0",
"funding": [
"https://github.com/sponsors/LuanRT"
],

View File

@@ -1,6 +1,6 @@
{
"name": "youtubei.js",
"version": "3.1.0",
"version": "3.2.0",
"description": "A wrapper around YouTube's private API. Supports YouTube, YouTube Music, YouTube Kids and YouTube Studio (WIP).",
"type": "module",
"types": "./dist/src/platform/lib.d.ts",

View File

@@ -21,6 +21,7 @@ import PlaylistManager from './core/PlaylistManager.js';
import YTStudio from './core/Studio.js';
import TabbedFeed from './core/TabbedFeed.js';
import HomeFeed from './parser/youtube/HomeFeed.js';
import Guide from './parser/youtube/Guide.js';
import Proto from './proto/index.js';
import Constants from './utils/Constants.js';
@@ -170,6 +171,14 @@ class Innertube {
return new HomeFeed(this.actions, response);
}
/**
* Retrieves YouTube's content guide.
*/
async getGuide(): Promise<Guide> {
const response = await this.actions.execute('/guide');
return new Guide(response.data);
}
/**
* Returns the account's library.
*/

View File

@@ -4,6 +4,7 @@ import { concatMemos, InnertubeError } from '../utils/Utils.js';
import type Actions from './Actions.js';
import BackstagePost from '../parser/classes/BackstagePost.js';
import SharedPost from '../parser/classes/SharedPost.js';
import Channel from '../parser/classes/Channel.js';
import CompactVideo from '../parser/classes/CompactVideo.js';
import GridChannel from '../parser/classes/GridChannel.js';
@@ -100,7 +101,7 @@ class Feed<T extends IParsedResponse = IParsedResponse> {
* Get all the community posts in the feed
*/
get posts() {
return this.#memo.getType<Post | BackstagePost>([ BackstagePost, Post ]);
return this.#memo.getType<Post | BackstagePost | SharedPost>([ BackstagePost, Post, SharedPost ]);
}
/**

View File

@@ -28,6 +28,10 @@ import type { ObservedArray, YTNode } from '../parser/helpers.js';
import type Actions from './Actions.js';
import type Session from './Session.js';
export type SearchFilters = {
type?: 'all' | 'song' | 'video' | 'album' | 'playlist' | 'artist';
};
class Music {
#session: Session;
#actions: Actions;
@@ -108,9 +112,7 @@ class Music {
* @param query - Search query.
* @param filters - Search filters.
*/
async search(query: string, filters: {
type?: 'all' | 'song' | 'video' | 'album' | 'playlist' | 'artist';
} = {}): Promise<Search> {
async search(query: string, filters: SearchFilters = {}): Promise<Search> {
throwIfMissing({ query });
const payload: {

View File

@@ -1,6 +1,7 @@
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class AccountChannel extends YTNode {
static type = 'AccountChannel';
@@ -8,7 +9,7 @@ class AccountChannel extends YTNode {
title: Text;
endpoint: NavigationEndpoint;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);

View File

@@ -6,6 +6,7 @@ import NavigationEndpoint from './NavigationEndpoint.js';
import AccountItemSectionHeader from './AccountItemSectionHeader.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class AccountItem {
static type = 'AccountItem';
@@ -18,7 +19,7 @@ class AccountItem {
endpoint: NavigationEndpoint;
account_byline: Text;
constructor(data: any) {
constructor(data: RawNode) {
this.account_name = new Text(data.accountName);
this.account_photo = Thumbnail.fromResponse(data.accountPhoto);
this.is_selected = data.isSelected;
@@ -35,7 +36,7 @@ class AccountItemSection extends YTNode {
contents;
header;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.contents = data.contents.map((ac: any) => new AccountItem(ac.accountItem));
this.header = Parser.parseItem<AccountItemSectionHeader>(data.header, AccountItemSectionHeader);

View File

@@ -1,12 +1,12 @@
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class AccountItemSectionHeader extends YTNode {
static type = 'AccountItemSectionHeader';
title: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
}

View File

@@ -3,14 +3,14 @@ import AccountChannel from './AccountChannel.js';
import AccountItemSection from './AccountItemSection.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class AccountSectionList extends YTNode {
static type = 'AccountSectionList';
contents;
footers;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.contents = Parser.parseItem<AccountItemSection>(data.contents[0], AccountItemSection);
this.footers = Parser.parseItem<AccountChannel>(data.footers[0], AccountChannel);

View File

@@ -1,13 +1,13 @@
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class Alert extends YTNode {
static type = 'Alert';
text: Text;
alert_type: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.text = new Text(data.text);
this.alert_type = data.type;

View File

@@ -1,11 +1,11 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class AudioOnlyPlayability extends YTNode {
static type = 'AudioOnlyPlayability';
audio_only_availability: string;
constructor (data: any) {
constructor (data: RawNode) {
super();
this.audio_only_availability = data.audioOnlyAvailability;
}

View File

@@ -1,12 +1,12 @@
import { YTNode } from '../helpers.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import type { RawNode } from '../index.js';
class AutomixPreviewVideo extends YTNode {
static type = 'AutomixPreviewVideo';
playlist_video?: { endpoint: NavigationEndpoint };
constructor(data: any) {
constructor(data: RawNode) {
super();
if (data?.content?.automixPlaylistVideoRenderer?.navigationEndpoint) {
this.playlist_video = {

View File

@@ -0,0 +1,35 @@
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideCollapsibleEntry extends YTNode {
static type = 'GuideCollapsibleEntry';
expander_item: {
title: string,
icon_type: string
};
collapser_item: {
title: string,
icon_type: string
};
expandable_items;
constructor(data: any) {
super();
this.expander_item = {
title: new Text(data.expanderItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.expanderItem.guideEntryRenderer.icon.iconType
};
this.collapser_item = {
title: new Text(data.collapserItem.guideEntryRenderer.formattedTitle).toString(),
icon_type: data.collapserItem.guideEntryRenderer.icon.iconType
};
this.expandable_items = Parser.parseArray(data.expandableItems);
}
}
export default GuideCollapsibleEntry;

View File

@@ -0,0 +1,23 @@
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideCollapsibleSectionEntry extends YTNode {
static type = 'GuideCollapsibleSectionEntry';
header_entry;
expander_icon: string;
collapser_icon: string;
section_items;
constructor(data: any) {
super();
this.header_entry = Parser.parseItem(data.headerEntry);
this.expander_icon = data.expanderIcon.iconType;
this.collapser_icon = data.collapserIcon.iconType;
this.section_items = Parser.parseArray(data.sectionItems);
}
}
export default GuideCollapsibleSectionEntry;

View File

@@ -0,0 +1,14 @@
import GuideEntry from './GuideEntry.js';
class GuideDownloadsEntry extends GuideEntry {
static type = 'GuideDownloadsEntry';
always_show: boolean;
constructor(data: any) {
super(data.entryRenderer.guideEntryRenderer);
this.always_show = !!data.alwaysShow;
}
}
export default GuideDownloadsEntry;

View File

@@ -0,0 +1,33 @@
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
import Thumbnail from './misc/Thumbnail.js';
class GuideEntry extends YTNode {
static type = 'GuideEntry';
title: Text;
endpoint: NavigationEndpoint;
icon_type?: string;
thumbnails?: Thumbnail[];
badges?: any;
is_primary: boolean;
constructor(data: any) {
super();
this.title = new Text(data.formattedTitle);
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
if (data.icon?.iconType) {
this.icon_type = data.icon.iconType;
}
if (data.thumbnail) {
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
}
if (data.badges) {
this.badges = data.badges;
}
this.is_primary = !!data.isPrimary;
}
}
export default GuideEntry;

View File

@@ -0,0 +1,20 @@
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import Parser from '../parser.js';
class GuideSection extends YTNode {
static type = 'GuideSection';
title?: Text;
items;
constructor(data: any) {
super();
if (data.formattedTitle) {
this.title = new Text(data.formattedTitle);
}
this.items = Parser.parseArray(data.items);
}
}
export default GuideSection;

View File

@@ -0,0 +1,7 @@
import GuideSection from './GuideSection.js';
class GuideSubscriptionsSection extends GuideSection {
static type = 'GuideSubscriptionsSection';
}
export default GuideSubscriptionsSection;

View File

@@ -0,0 +1,19 @@
import { YTNode } from '../helpers.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import Thumbnail from './misc/Thumbnail.js';
class HeroPlaylistThumbnail extends YTNode {
static type = 'HeroPlaylistThumbnail';
thumbnails: Thumbnail[];
on_tap_endpoint: NavigationEndpoint;
constructor(data: any) {
super();
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
this.on_tap_endpoint = new NavigationEndpoint(data.onTap);
}
}
export default HeroPlaylistThumbnail;

View File

@@ -0,0 +1,21 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class PlayerLegacyDesktopYpcOffer extends YTNode {
static type = 'PlayerLegacyDesktopYpcOffer';
title: string;
thumbnail: string;
offer_description: string;
offer_id: string;
constructor(data: RawNode) {
super();
this.title = data.itemTitle;
this.thumbnail = data.itemThumbnail;
this.offer_description = data.offerDescription;
this.offer_id = data.offerId;
}
}
export default PlayerLegacyDesktopYpcOffer;

View File

@@ -21,6 +21,7 @@ class PlaylistHeader extends YTNode {
save_button;
shuffle_play_button;
menu;
banner;
constructor(data: any) {
super();
@@ -39,6 +40,7 @@ class PlaylistHeader extends YTNode {
this.save_button = Parser.parse(data.saveButton);
this.shuffle_play_button = Parser.parse(data.shufflePlayButton);
this.menu = Parser.parse(data.moreActionsMenu);
this.banner = Parser.parseItem(data.playlistHeaderBanner);
}
}

View File

@@ -0,0 +1,32 @@
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
class RichMetadata extends YTNode {
static type = 'RichMetadata';
thumbnail: Thumbnail[];
title: Text;
subtitle?: Text;
call_to_action: Text;
icon_type?: string;
endpoint: NavigationEndpoint;
constructor(data: any) {
super();
this.thumbnail = Thumbnail.fromResponse(data.thumbnail);
this.title = new Text(data.title);
this.subtitle = new Text(data.subtitle);
this.call_to_action = new Text(data.callToAction);
if (data.callToActionIcon?.iconType) {
this.icon_type = data.callToActionIcon?.iconType;
}
this.endpoint = new NavigationEndpoint(data.endpoint);
}
}
export default RichMetadata;

View File

@@ -0,0 +1,15 @@
import Parser from '../index.js';
import { YTNode } from '../helpers.js';
class RichMetadataRow extends YTNode {
static type = 'RichMetadataRow';
contents;
constructor(data: any) {
super();
this.contents = Parser.parseArray(data.contents);
}
}
export default RichMetadataRow;

View File

@@ -0,0 +1,22 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Text from './misc/Text.js';
import NavigationEndpoint from './NavigationEndpoint.js';
class SearchFilter extends YTNode {
static type = 'SearchFilter';
label: Text;
endpoint: NavigationEndpoint;
tooltip: string;
constructor(data: RawNode) {
super();
this.label = new Text(data.label);
this.endpoint = new NavigationEndpoint(data.endpoint);
this.tooltip = data.tooltip;
}
}
export default SearchFilter;

View File

@@ -0,0 +1,21 @@
import { ObservedArray, YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import { Parser } from '../index.js';
import Text from './misc/Text.js';
import SearchFilter from './SearchFilter.js';
class SearchFilterGroup extends YTNode {
static type = 'SearchFilterGroup';
title: Text;
filters: ObservedArray<SearchFilter> | null;
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.filters = Parser.parseArray(data.filters, SearchFilter);
}
}
export default SearchFilterGroup;

View File

@@ -0,0 +1,23 @@
import { ObservedArray, YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Parser from '../index.js';
import Text from './misc/Text.js';
import SearchFilterGroup from './SearchFilterGroup.js';
import ToggleButton from './ToggleButton.js';
class SearchSubMenu extends YTNode {
static type = 'SearchSubMenu';
title: Text;
groups: ObservedArray<SearchFilterGroup> | null;
button: ToggleButton | null;
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.groups = Parser.parseArray(data.groups, SearchFilterGroup);
this.button = Parser.parseItem(data.button, ToggleButton);
}
}
export default SearchSubMenu;

View File

@@ -1,17 +1,19 @@
import Parser from '../index.js';
import ToggleButton from './ToggleButton.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import Parser from '../index.js';
import Button from './Button.js';
import ToggleButton from './ToggleButton.js';
class SegmentedLikeDislikeButton extends YTNode {
static type = 'SegmentedLikeDislikeButton';
like_button: ToggleButton | null;
dislike_button: ToggleButton | null;
like_button: ToggleButton | Button | null;
dislike_button: ToggleButton | Button | null;
constructor (data: any) {
constructor (data: RawNode) {
super();
this.like_button = Parser.parseItem<ToggleButton>(data.likeButton, ToggleButton);
this.dislike_button = Parser.parseItem<ToggleButton>(data.dislikeButton, ToggleButton);
this.like_button = Parser.parseItem<ToggleButton | Button>(data.likeButton, [ ToggleButton, Button ]);
this.dislike_button = Parser.parseItem<ToggleButton | Button>(data.dislikeButton, [ ToggleButton, Button ]);
}
}

View File

@@ -0,0 +1,38 @@
import { YTNode } from '../helpers.js';
import { Menu } from '../map.js';
import Parser from '../parser.js';
import BackstagePost from './BackstagePost.js';
import Button from './Button.js';
import Author from './misc/Author.js';
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
class SharedPost extends YTNode {
static type = 'SharedPost';
thumbnail: Thumbnail[];
content: Text;
published: Text;
menu: Menu | null;
original_post: BackstagePost | null;
id: string;
endpoint: NavigationEndpoint;
expand_button: Button | null;
author: Author;
constructor(data: any) {
super();
this.thumbnail = Thumbnail.fromResponse(data.thumbnail);
this.content = new Text(data.content);
this.published = new Text(data.publishedTimeText);
this.menu = Parser.parseItem(data.actionMenu, Menu);
this.original_post = Parser.parseItem(data.originalPost, BackstagePost);
this.id = data.postId;
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
this.expand_button = Parser.parseItem(data.expandButton, Button);
this.author = new Author(data.displayName, undefined);
}
}
export default SharedPost;

View File

@@ -1,6 +1,9 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import type { ObservedArray } from '../helpers.js';
import Parser from '../index.js';
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import MetadataBadge from './MetadataBadge.js';
import Menu from './menus/Menu.js';
class VideoPrimaryInfo extends YTNode {
@@ -10,16 +13,20 @@ class VideoPrimaryInfo extends YTNode {
super_title_link: Text;
view_count: Text;
short_view_count: Text;
badges: ObservedArray<MetadataBadge>;
published: Text;
menu;
relative_date: Text;
menu: Menu | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.super_title_link = new Text(data.superTitleLink);
this.view_count = new Text(data.viewCount.videoViewCountRenderer.viewCount);
this.short_view_count = new Text(data.viewCount.videoViewCountRenderer.shortViewCount);
this.view_count = new Text(data.viewCount?.videoViewCountRenderer?.viewCount);
this.short_view_count = new Text(data.viewCount?.videoViewCountRenderer?.shortViewCount);
this.badges = Parser.parseArray(data.badges, MetadataBadge);
this.published = new Text(data.dateText);
this.relative_date = new Text(data.relativeDateText);
this.menu = Parser.parseItem(data.videoActions, Menu);
}
}

View File

@@ -1,5 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AppendContinuationItemsAction extends YTNode {
static type = 'AppendContinuationItemsAction';
@@ -7,7 +8,7 @@ class AppendContinuationItemsAction extends YTNode {
items;
target: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.items = Parser.parse(data.continuationItems);
this.target = data.target;

View File

@@ -1,5 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class OpenPopupAction extends YTNode {
static type = 'OpenPopupAction';
@@ -7,7 +8,7 @@ class OpenPopupAction extends YTNode {
popup;
popup_type;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.popup = Parser.parse(data.popup);
this.popup_type = data.popupType;

View File

@@ -1,5 +1,6 @@
import DataModelSection from './DataModelSection.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AnalyticsMainAppKeyMetrics extends YTNode {
static type = 'AnalyticsMainAppKeyMetrics';
@@ -7,7 +8,7 @@ class AnalyticsMainAppKeyMetrics extends YTNode {
period: string;
sections: DataModelSection[];
constructor(data: any) {
constructor(data: RawNode) {
super();
this.period = data.cardData.periodLabel;
const metrics_data = data.cardData.sections[0].analyticsKeyMetricsData;

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AnalyticsRoot extends YTNode {
static type = 'AnalyticsRoot';
@@ -19,7 +20,7 @@ class AnalyticsRoot extends YTNode {
}[];
}[];
constructor(data: any) {
constructor(data: RawNode) {
super();
const cards = data.analyticsTableCarouselData.data.tableCards;

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
import NavigationEndpoint from '../NavigationEndpoint.js';
class AnalyticsShortsCarouselCard extends YTNode {
@@ -11,7 +12,7 @@ class AnalyticsShortsCarouselCard extends YTNode {
endpoint: NavigationEndpoint;
}[];
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.title;
this.shorts = data.shortsCarouselData.shorts.map((short: any) => ({

View File

@@ -1,5 +1,6 @@
import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AnalyticsVideo extends YTNode {
static type = 'AnalyticsVideo';
@@ -13,7 +14,7 @@ class AnalyticsVideo extends YTNode {
is_short: boolean;
};
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.videoTitle;

View File

@@ -1,5 +1,6 @@
import Video from './AnalyticsVideo.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AnalyticsVodCarouselCard extends YTNode {
static type = 'AnalyticsVodCarouselCard';
@@ -8,7 +9,7 @@ class AnalyticsVodCarouselCard extends YTNode {
videos: Video[] | null;
no_data_message?: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.title;

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CtaGoToCreatorStudio extends YTNode {
static type = 'CtaGoToCreatorStudio';
@@ -6,7 +7,7 @@ class CtaGoToCreatorStudio extends YTNode {
title: string;
use_new_specs: boolean;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.buttonLabel;
this.use_new_specs = data.useNewSpecs;

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class DataModelSection extends YTNode {
static type = 'DataModelSection';
@@ -36,7 +37,7 @@ class DataModelSection extends YTNode {
}
};
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.title;

View File

@@ -1,6 +1,7 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class StatRow extends YTNode {
static type = 'StatRow';
@@ -8,7 +9,7 @@ class StatRow extends YTNode {
title: Text;
contents: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.contents = new Text(data.contents);

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AuthorCommentBadge extends YTNode {
static type = 'AuthorCommentBadge';
@@ -9,7 +10,7 @@ class AuthorCommentBadge extends YTNode {
tooltip: string;
style?: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.icon_type = data.icon?.iconType || null;

View File

@@ -16,6 +16,7 @@ import type Actions from '../../../core/Actions.js';
import Proto from '../../../proto/index.js';
import { InnertubeError } from '../../../utils/Utils.js';
import { YTNode, SuperParsedResult } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class Comment extends YTNode {
static type = 'Comment';
@@ -44,7 +45,7 @@ class Comment extends YTNode {
is_pinned: boolean;
is_member: boolean;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.content = new Text(data.contentText);
this.published = new Text(data.publishedTimeText);

View File

@@ -3,6 +3,7 @@ import type Button from '../Button.js';
import type ToggleButton from '../ToggleButton.js';
import type CreatorHeart from './CreatorHeart.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentActionButtons extends YTNode {
static type = 'CommentActionButtons';
@@ -12,7 +13,7 @@ class CommentActionButtons extends YTNode {
reply_button;
creator_heart;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.like_button = Parser.parseItem<ToggleButton>(data.likeButton);
this.dislike_button = Parser.parseItem<ToggleButton>(data.dislikeButton);

View File

@@ -4,6 +4,7 @@ import Thumbnail from '../misc/Thumbnail.js';
import type Button from '../Button.js';
import type EmojiPicker from './EmojiPicker.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentDialog extends YTNode {
static type = 'CommentDialog';
@@ -16,7 +17,7 @@ class CommentDialog extends YTNode {
emoji_button: Button | null;
emoji_picker: any | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.editable_text = new Text(data.editableText);
this.author_thumbnail = Thumbnail.fromResponse(data.authorThumbnail);

View File

@@ -2,7 +2,7 @@ import Parser from '../../index.js';
import Thumbnail from '../misc/Thumbnail.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentReplies extends YTNode {
static type = 'CommentReplies';
@@ -12,7 +12,7 @@ class CommentReplies extends YTNode {
view_replies_creator_thumbnail: Thumbnail[];
has_channel_owner_replied: boolean;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.contents = Parser.parseArray(data.contents);
this.view_replies = Parser.parseItem<Button>(data.viewReplies);

View File

@@ -3,6 +3,7 @@ import Thumbnail from '../misc/Thumbnail.js';
import Text from '../misc/Text.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentReplyDialog extends YTNode {
static type = 'CommentReplyDialog';
@@ -13,7 +14,7 @@ class CommentReplyDialog extends YTNode {
placeholder: Text;
error_message: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.reply_button = Parser.parseItem<Button>(data.replyButton);
this.cancel_button = Parser.parseItem<Button>(data.cancelButton);

View File

@@ -3,6 +3,7 @@ import Thumbnail from '../misc/Thumbnail.js';
import Text from '../misc/Text.js';
import type Button from '../Button.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentSimplebox extends YTNode {
static type = 'CommentSimplebox';
@@ -13,7 +14,7 @@ class CommentSimplebox extends YTNode {
placeholder: Text;
avatar_size;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.submit_button = Parser.parseItem<Button>(data.submitButton);
this.cancel_button = Parser.parseItem<Button>(data.cancelButton);

View File

@@ -7,6 +7,7 @@ import type Actions from '../../../core/Actions.js';
import type { ObservedArray } from '../../helpers.js';
import { InnertubeError } from '../../../utils/Utils.js';
import { observe, YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentThread extends YTNode {
static type = 'CommentThread';
@@ -20,7 +21,7 @@ class CommentThread extends YTNode {
is_moderated_elq_comment: boolean;
has_replies: boolean;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.comment = Parser.parseItem<Comment>(data.comment, Comment);
this.comment_replies_data = Parser.parseItem<CommentReplies>(data.replies);

View File

@@ -1,6 +1,7 @@
import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentsEntryPointHeader extends YTNode {
static type = 'CommentsEntryPointHeader';
@@ -11,7 +12,7 @@ class CommentsEntryPointHeader extends YTNode {
teaser_content?: Text;
simplebox_placeholder?: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
if (data.header) {

View File

@@ -3,6 +3,7 @@ import Text from '../misc/Text.js';
import Thumbnail from '../misc/Thumbnail.js';
import type SortFilterSubMenu from '../SortFilterSubMenu.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class CommentsHeader extends YTNode {
static type = 'CommentsHeader';
@@ -21,7 +22,7 @@ class CommentsHeader extends YTNode {
is_custom_emoji: boolean;
}[] | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.titleText);
this.count = new Text(data.countText);

View File

@@ -1,5 +1,6 @@
import { YTNode } from '../../helpers.js';
import Thumbnail from '../misc/Thumbnail.js';
import type { RawNode } from '../../index.js';
class CreatorHeart extends YTNode {
static type = 'CreatorHeart';
@@ -16,7 +17,7 @@ class CreatorHeart extends YTNode {
is_enabled: boolean;
kennedy_heart_color_string: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.creator_thumbnail = Thumbnail.fromResponse(data.creatorThumbnail);
this.heart_icon_type = data.heartIcon?.iconType;

View File

@@ -1,6 +1,7 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import Parser from '../../index.js';
import type { RawNode } from '../../index.js';
class EmojiPicker extends YTNode {
static type = 'EmojiPicker';
@@ -19,7 +20,7 @@ class EmojiPicker extends YTNode {
skin_tone_medium_dark_label: string;
skin_tone_dark_label: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;
this.categories = Parser.parseArray(data.categories);

View File

@@ -1,5 +1,6 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class PdgCommentChip extends YTNode {
static type = 'PdgCommentChip';
@@ -11,7 +12,7 @@ class PdgCommentChip extends YTNode {
};
icon_type: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.text = new Text(data.chipText);
this.color_pallette = {

View File

@@ -1,5 +1,6 @@
import Thumbnail from '../misc/Thumbnail.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class SponsorCommentBadge extends YTNode {
static type = 'SponsorCommentBadge';
@@ -7,7 +8,7 @@ class SponsorCommentBadge extends YTNode {
custom_badge: Thumbnail[];
tooltip: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.custom_badge = Thumbnail.fromResponse(data.customBadge);
this.tooltip = data.tooltip;

View File

@@ -1,13 +1,14 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type LiveChatBanner from './items/LiveChatBanner.js';
import type { RawNode } from '../../index.js';
class AddBannerToLiveChatCommand extends YTNode {
static type = 'AddBannerToLiveChatCommand';
banner: LiveChatBanner | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.banner = Parser.parseItem<LiveChatBanner>(data.bannerRenderer);
}

View File

@@ -1,5 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AddChatItemAction extends YTNode {
static type = 'AddChatItemAction';
@@ -7,7 +8,7 @@ class AddChatItemAction extends YTNode {
item;
client_id: string | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.item = Parser.parseItem(data.item);
this.client_id = data.clientId || null;

View File

@@ -1,5 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class AddLiveChatTickerItemAction extends YTNode {
static type = 'AddLiveChatTickerItemAction';
@@ -7,7 +8,7 @@ class AddLiveChatTickerItemAction extends YTNode {
item;
duration_sec: string; // TODO: check this assumption
constructor(data: any) {
constructor(data: RawNode) {
super();
this.item = Parser.parseItem(data.item);
this.duration_sec = data.durationSec;

View File

@@ -1,11 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class DimChatItemAction extends YTNode {
static type = 'DimChatItemAction';
client_assigned_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.client_assigned_id = data.clientAssignedId;
}

View File

@@ -1,6 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class LiveChatActionPanel extends YTNode {
static type = 'LiveChatActionPanel';
@@ -8,7 +8,7 @@ class LiveChatActionPanel extends YTNode {
contents;
target_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;
this.contents = Parser.parse(data.contents);

View File

@@ -1,13 +1,13 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MarkChatItemAsDeletedAction extends YTNode {
static type = 'MarkChatItemAsDeletedAction';
deleted_state_message: Text;
target_item_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.deleted_state_message = new Text(data.deletedStateMessage);
this.target_item_id = data.targetItemId;

View File

@@ -1,13 +1,13 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MarkChatItemsByAuthorAsDeletedAction extends YTNode {
static type = 'MarkChatItemsByAuthorAsDeletedAction';
deleted_state_message: Text;
channel_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.deleted_state_message = new Text(data.deletedStateMessage);
this.channel_id = data.externalChannelId;

View File

@@ -1,11 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class RemoveBannerForLiveChatCommand extends YTNode {
static type = 'RemoveBannerForLiveChatCommand';
target_action_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.target_action_id = data.targetActionId;
}

View File

@@ -1,11 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class RemoveChatItemAction extends YTNode {
static type = 'RemoveChatItemAction';
target_item_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.target_item_id = data.targetItemId;
}

View File

@@ -1,11 +1,11 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class RemoveChatItemByAuthorAction extends YTNode {
static type = 'RemoveChatItemByAuthorAction';
external_channel_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.external_channel_id = data.externalChannelId;
}

View File

@@ -1,13 +1,13 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class ReplaceChatItemAction extends YTNode {
static type = 'ReplaceChatItemAction';
target_item_id: string;
replacement_item;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.target_item_id = data.targetItemId;
this.replacement_item = Parser.parseItem(data.replacementItem);

View File

@@ -1,13 +1,13 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class ReplayChatItemAction extends YTNode {
static type = 'ReplayChatItemAction';
actions;
video_offset_time_msec: string; // Or number?
constructor(data: any) {
constructor(data: RawNode) {
super();
this.actions = Parser.parseArray(data.actions?.map((action: any) => {
delete action.clickTrackingParams;

View File

@@ -1,13 +1,13 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import LiveChatActionPanel from './LiveChatActionPanel.js';
import type { RawNode } from '../../index.js';
class ShowLiveChatActionPanelAction extends YTNode {
static type = 'ShowLiveChatActionPanelAction';
panel_to_show: LiveChatActionPanel | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.panel_to_show = Parser.parseItem<LiveChatActionPanel>(data.panelToShow, LiveChatActionPanel);
}

View File

@@ -1,12 +1,12 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class ShowLiveChatDialogAction extends YTNode {
static type = 'ShowLiveChatDialogAction';
dialog;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.dialog = Parser.parseItem(data.dialog);
}

View File

@@ -1,12 +1,12 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class ShowLiveChatTooltipCommand extends YTNode {
static type = 'ShowLiveChatTooltipCommand';
tooltip;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.tooltip = Parser.parseItem(data.tooltip);
}

View File

@@ -1,12 +1,12 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateDateTextAction extends YTNode {
static type = 'UpdateDateTextAction';
date_text: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.date_text = new Text(data.dateText).toString();
}

View File

@@ -1,12 +1,12 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateDescriptionAction extends YTNode {
static type = 'UpdateDescriptionAction';
description: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.description = new Text(data.description);
}

View File

@@ -1,12 +1,12 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateLiveChatPollAction extends YTNode {
static type = 'UpdateLiveChatPollAction';
poll_to_update;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.poll_to_update = Parser.parseItem(data.pollToUpdate);
}

View File

@@ -1,12 +1,12 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateTitleAction extends YTNode {
static type = 'UpdateTitleAction';
title: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
}

View File

@@ -1,6 +1,6 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateToggleButtonTextAction extends YTNode {
static type = 'UpdateToggleButtonTextAction';
@@ -8,7 +8,7 @@ class UpdateToggleButtonTextAction extends YTNode {
toggled_text: string;
button_id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.default_text = new Text(data.defaultText).toString();
this.toggled_text = new Text(data.toggledText).toString();

View File

@@ -1,6 +1,6 @@
import Text from '../misc/Text.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class UpdateViewershipAction extends YTNode {
static type = 'UpdateViewershipAction';
@@ -8,7 +8,7 @@ class UpdateViewershipAction extends YTNode {
extra_short_view_count: Text;
is_live: boolean;
constructor(data: any) {
constructor(data: RawNode) {
super();
const view_count_renderer = data.viewCount.videoViewCountRenderer;
this.view_count = new Text(view_count_renderer.viewCount);

View File

@@ -3,6 +3,7 @@ import Parser from '../../../index.js';
import Button from '../../Button.js';
import Text from '../../misc/Text.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
class LiveChatAutoModMessage extends YTNode {
static type = 'LiveChatAutoModMessage';
@@ -15,7 +16,7 @@ class LiveChatAutoModMessage extends YTNode {
timestamp: number;
id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.menu_endpoint = new NavigationEndpoint(data.contextMenuEndpoint);
this.moderation_buttons = Parser.parseArray<Button>(data.moderationButtons, [ Button ]);

View File

@@ -1,6 +1,7 @@
import { YTNode } from '../../../helpers.js';
import Parser from '../../../index.js';
import type LiveChatBannerHeader from './LiveChatBannerHeader.js';
import type { RawNode } from '../../../index.js';
class LiveChatBanner extends YTNode {
static type = 'LiveChatBanner';
@@ -13,7 +14,7 @@ class LiveChatBanner extends YTNode {
is_stackable: boolean;
background_type: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.header = Parser.parseItem<LiveChatBannerHeader>(data.header);
this.contents = Parser.parseItem(data.contents);

View File

@@ -2,6 +2,7 @@ import { YTNode } from '../../../helpers.js';
import Parser from '../../../index.js';
import type Button from '../../Button.js';
import Text from '../../misc/Text.js';
import type { RawNode } from '../../../index.js';
class LiveChatBannerHeader extends YTNode {
static type = 'LiveChatBannerHeader';
@@ -10,7 +11,7 @@ class LiveChatBannerHeader extends YTNode {
icon_type: string;
context_menu_button: Button | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.text = new Text(data.text).toString();
this.icon_type = data.icon?.iconType;

View File

@@ -2,7 +2,7 @@ import { YTNode } from '../../../helpers.js';
import Parser from '../../../index.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import type { RawNode } from '../../../index.js';
class LiveChatBannerPoll extends YTNode {
static type = 'LiveChatBannerPoll';
@@ -17,7 +17,7 @@ class LiveChatBannerPoll extends YTNode {
live_chat_poll_state_entity_key: string;
context_menu_button;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.poll_question = new Text(data.pollQuestion);
this.author_photo = Thumbnail.fromResponse(data.authorPhoto);

View File

@@ -5,7 +5,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
class LiveChatMembershipItem extends YTNode {
static type = 'LiveChatMembershipItem';
@@ -25,7 +25,7 @@ class LiveChatMembershipItem extends YTNode {
menu_endpoint: NavigationEndpoint;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);

View File

@@ -5,7 +5,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
class LiveChatPaidMessage extends YTNode {
static type = 'LiveChatPaidMessage';
@@ -31,7 +31,7 @@ class LiveChatPaidMessage extends YTNode {
timestamp_text: string;
id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.message = new Text(data.message);

View File

@@ -5,6 +5,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
class LiveChatPaidSticker extends YTNode {
static type = 'LiveChatPaidSticker';
@@ -31,7 +32,7 @@ class LiveChatPaidSticker extends YTNode {
menu_endpoint?: NavigationEndpoint;
timestamp: number;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;

View File

@@ -1,4 +1,5 @@
import { YTNode } from '../../../helpers.js';
import type { RawNode } from '../../../index.js';
class LiveChatPlaceholderItem extends YTNode {
static type = 'LiveChatPlaceholderItem';
@@ -6,7 +7,7 @@ class LiveChatPlaceholderItem extends YTNode {
id: string;
timestamp: number;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;
this.timestamp = Math.floor(parseInt(data.timestampUsec) / 1000);

View File

@@ -1,5 +1,6 @@
import Parser from '../../../index.js';
import { YTNode } from '../../../helpers.js';
import type { RawNode } from '../../../index.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
@@ -23,7 +24,7 @@ class LiveChatProductItem extends YTNode {
is_verified: boolean;
creator_custom_message: Text;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.title;

View File

@@ -1,11 +1,12 @@
import { YTNode } from '../../../helpers.js';
import Text from '../../misc/Text.js';
import type { RawNode } from '../../../index.js';
class LiveChatRestrictedParticipation extends YTNode {
message: Text;
icon_type?: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.message = new Text(data.message);
this.icon_type = data?.icon?.iconType;

View File

@@ -6,6 +6,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
class LiveChatTextMessage extends YTNode {
static type = 'LiveChatTextMessage';
@@ -26,7 +27,7 @@ class LiveChatTextMessage extends YTNode {
timestamp: number;
id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.message = new Text(data.message);

View File

@@ -4,6 +4,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
import { observe, ObservedArray, YTNode } from '../../../helpers.js';
@@ -27,7 +28,7 @@ class LiveChatTickerPaidMessageItem extends YTNode {
show_item_endpoint: NavigationEndpoint;
id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.author = {

View File

@@ -4,6 +4,7 @@ import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import NavigationEndpoint from '../../NavigationEndpoint.js';
import type { RawNode } from '../../../index.js';
import { observe, ObservedArray, YTNode } from '../../../helpers.js';
@@ -27,7 +28,7 @@ class LiveChatTickerPaidStickerItem extends YTNode {
show_item_endpoint: NavigationEndpoint;
id: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.author = {

View File

@@ -4,6 +4,7 @@ import LiveChatAuthorBadge from '../../LiveChatAuthorBadge.js';
import MetadataBadge from '../../MetadataBadge.js';
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import type { RawNode } from '../../../index.js';
class LiveChatTickerSponsorItem extends YTNode {
static type = 'LiveChatTickerSponsorItem';
@@ -22,7 +23,7 @@ class LiveChatTickerSponsorItem extends YTNode {
duration_sec: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.id = data.id;
this.detail = new Text(data.detailText);

View File

@@ -1,5 +1,6 @@
import Parser from '../../../index.js';
import LiveChatTextMessage from './LiveChatTextMessage.js';
import type { RawNode } from '../../../index.js';
class LiveChatViewerEngagementMessage extends LiveChatTextMessage {
static type = 'LiveChatViewerEngagementMessage';
@@ -7,7 +8,7 @@ class LiveChatViewerEngagementMessage extends LiveChatTextMessage {
icon_type: string;
action_button;
constructor(data: any) {
constructor(data: RawNode) {
super(data);
delete this.author;
delete this.menu_endpoint;

View File

@@ -1,6 +1,7 @@
import Text from '../../misc/Text.js';
import Thumbnail from '../../misc/Thumbnail.js';
import Parser from '../../../index.js';
import type { RawNode } from '../../../index.js';
import { YTNode } from '../../../helpers.js';
class PollHeader extends YTNode {
@@ -12,7 +13,7 @@ class PollHeader extends YTNode {
live_chat_poll_type: string;
context_menu_button;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.poll_question = new Text(data.pollQuestion);
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);

View File

@@ -1,6 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class Menu extends YTNode {
static type = 'Menu';
@@ -8,7 +8,7 @@ class Menu extends YTNode {
top_level_buttons;
label;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.items = Parser.parseArray(data.items);
this.top_level_buttons = Parser.parseArray(data.topLevelButtons);

View File

@@ -1,9 +1,9 @@
import Button from '../Button.js';
import type { RawNode } from '../../index.js';
class MenuNavigationItem extends Button {
static type = 'MenuNavigationItem';
constructor(data: any) {
constructor(data: RawNode) {
super(data);
}
}

View File

@@ -1,9 +1,9 @@
import Button from '../Button.js';
import type { RawNode } from '../../index.js';
class MenuServiceItem extends Button {
static type = 'MenuServiceItem';
constructor(data: any) {
constructor(data: RawNode) {
super(data);
}
}

View File

@@ -1,13 +1,13 @@
import NavigationEndpoint from '../NavigationEndpoint.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MenuServiceItemDownload extends YTNode {
static type = 'MenuServiceItemDownload';
has_separator: boolean;
endpoint: NavigationEndpoint;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.has_separator = data.hasSeparator;
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);

View File

@@ -1,6 +1,6 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MultiPageMenu extends YTNode {
static type = 'MultiPageMenu';
@@ -8,7 +8,7 @@ class MultiPageMenu extends YTNode {
sections;
style: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.header = Parser.parse(data.header);
this.sections = Parser.parse(data.sections);

View File

@@ -1,12 +1,12 @@
import Parser from '../../index.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MultiPageMenuNotificationSection extends YTNode {
static type = 'MultiPageMenuNotificationSection';
items;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.items = Parser.parse(data.items);
}

View File

@@ -1,10 +1,10 @@
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
class MusicMenuItemDivider extends YTNode {
static type = 'MusicMenuItemDivider';
// eslint-disable-next-line
constructor(data: any) {
constructor(data: RawNode) {
super();
}
}

Some files were not shown because too many files have changed in this diff Show More