mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 07:42:11 +00:00
feat(VideoInfo): add game_info and category (#333)
This commit is contained in:
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;
|
||||
Reference in New Issue
Block a user