mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
chore(parser): import YTNodes directly to reduce web bundle size
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import Author from './misc/Author.js';
|
||||
import { YTNodes } from '../index.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';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
class SharedPost extends YTNode {
|
||||
static type = 'SharedPost';
|
||||
@@ -12,11 +14,11 @@ class SharedPost extends YTNode {
|
||||
thumbnail: Thumbnail[];
|
||||
content: Text;
|
||||
published: Text;
|
||||
menu: YTNodes.Menu | null;
|
||||
original_post: YTNodes.BackstagePost | null;
|
||||
menu: Menu | null;
|
||||
original_post: BackstagePost | null;
|
||||
id: string;
|
||||
endpoint: NavigationEndpoint;
|
||||
expand_button: YTNodes.Button | null;
|
||||
expand_button: Button | null;
|
||||
author: Author;
|
||||
|
||||
constructor(data: any) {
|
||||
@@ -24,11 +26,11 @@ class SharedPost extends YTNode {
|
||||
this.thumbnail = Thumbnail.fromResponse(data.thumbnail);
|
||||
this.content = new Text(data.content);
|
||||
this.published = new Text(data.publishedTimeText);
|
||||
this.menu = Parser.parseItem(data.actionMenu, [ YTNodes.Menu ]);
|
||||
this.original_post = Parser.parseItem(data.originalPost, [ YTNodes.BackstagePost ]);
|
||||
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, [ YTNodes.Button ]);
|
||||
this.expand_button = Parser.parseItem(data.expandButton, Button);
|
||||
this.author = new Author(data.displayName, undefined);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user