mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-14 01:52:11 +00:00
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
197bb759cd | ||
|
|
c76b24b3f4 | ||
|
|
574b67a1f7 | ||
|
|
9b2738f128 | ||
|
|
95f1d4077f | ||
|
|
a511608f18 | ||
|
|
cf8a33c79f | ||
|
|
cfc1a183e0 | ||
|
|
95033e723e | ||
|
|
2cc7b8bcd6 | ||
|
|
2d774e26aa | ||
|
|
214aa147ce | ||
|
|
ce53ac1843 | ||
|
|
0ad26f28d9 | ||
|
|
4c7b8a3403 |
27
CHANGELOG.md
27
CHANGELOG.md
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
4
package-lock.json
generated
@@ -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"
|
||||
],
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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 ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
35
src/parser/classes/GuideCollapsibleEntry.ts
Normal file
35
src/parser/classes/GuideCollapsibleEntry.ts
Normal 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;
|
||||
23
src/parser/classes/GuideCollapsibleSectionEntry.ts
Normal file
23
src/parser/classes/GuideCollapsibleSectionEntry.ts
Normal 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;
|
||||
14
src/parser/classes/GuideDownloadsEntry.ts
Normal file
14
src/parser/classes/GuideDownloadsEntry.ts
Normal 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;
|
||||
33
src/parser/classes/GuideEntry.ts
Normal file
33
src/parser/classes/GuideEntry.ts
Normal 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;
|
||||
20
src/parser/classes/GuideSection.ts
Normal file
20
src/parser/classes/GuideSection.ts
Normal 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;
|
||||
7
src/parser/classes/GuideSubscriptionsSection.ts
Normal file
7
src/parser/classes/GuideSubscriptionsSection.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import GuideSection from './GuideSection.js';
|
||||
|
||||
class GuideSubscriptionsSection extends GuideSection {
|
||||
static type = 'GuideSubscriptionsSection';
|
||||
}
|
||||
|
||||
export default GuideSubscriptionsSection;
|
||||
19
src/parser/classes/HeroPlaylistThumbnail.ts
Normal file
19
src/parser/classes/HeroPlaylistThumbnail.ts
Normal 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;
|
||||
21
src/parser/classes/PlayerLegacyDesktopYpcOffer.ts
Normal file
21
src/parser/classes/PlayerLegacyDesktopYpcOffer.ts
Normal 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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
32
src/parser/classes/RichMetadata.ts
Normal file
32
src/parser/classes/RichMetadata.ts
Normal 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;
|
||||
15
src/parser/classes/RichMetadataRow.ts
Normal file
15
src/parser/classes/RichMetadataRow.ts
Normal 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;
|
||||
22
src/parser/classes/SearchFilter.ts
Normal file
22
src/parser/classes/SearchFilter.ts
Normal 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;
|
||||
21
src/parser/classes/SearchFilterGroup.ts
Normal file
21
src/parser/classes/SearchFilterGroup.ts
Normal 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;
|
||||
23
src/parser/classes/SearchSubMenu.ts
Normal file
23
src/parser/classes/SearchSubMenu.ts
Normal 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;
|
||||
@@ -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 ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
38
src/parser/classes/SharedPost.ts
Normal file
38
src/parser/classes/SharedPost.ts
Normal 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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) => ({
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 ]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user