1+ import { YTNode } from '../helpers.js' ;
2+ import type { RawNode } from '../index.js' ;
3+ import type { ObservedArray } from '../helpers.js' ;
4+ import { YTNodes } from '../index.js' ;
15import Parser from '../index.js' ;
26import Text from './misc/Text.js' ;
3- import { YTNode } from '../helpers.js' ;
4- import Menu from './menus/Menu.js' ;
57
68class VideoPrimaryInfo extends YTNode {
79 static type = 'VideoPrimaryInfo' ;
@@ -10,17 +12,21 @@ class VideoPrimaryInfo extends YTNode {
1012 super_title_link : Text ;
1113 view_count : Text ;
1214 short_view_count : Text ;
15+ badges : ObservedArray < YTNodes . MetadataBadge > ;
1316 published : Text ;
14- menu ;
17+ relative_date : Text ;
18+ menu : YTNodes . Menu | null ;
1519
16- constructor ( data : any ) {
20+ constructor ( data : RawNode ) {
1721 super ( ) ;
1822 this . title = new Text ( data . title ) ;
1923 this . super_title_link = new Text ( data . superTitleLink ) ;
20- this . view_count = new Text ( data . viewCount . videoViewCountRenderer . viewCount ) ;
21- this . short_view_count = new Text ( data . viewCount . videoViewCountRenderer . shortViewCount ) ;
24+ this . view_count = new Text ( data . viewCount ?. videoViewCountRenderer ?. viewCount ) ;
25+ this . short_view_count = new Text ( data . viewCount ?. videoViewCountRenderer ?. shortViewCount ) ;
26+ this . badges = Parser . parseArray ( data . badges , YTNodes . MetadataBadge ) ;
2227 this . published = new Text ( data . dateText ) ;
23- this . menu = Parser . parseItem ( data . videoActions , Menu ) ;
28+ this . relative_date = new Text ( data . relativeDateText ) ;
29+ this . menu = Parser . parseItem ( data . videoActions , YTNodes . Menu ) ;
2430 }
2531}
2632
0 commit comments