forked from LuanRT/YouTube.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): add
GridShow
and ShowCustomThumbnail
Closes LuanRT#459
- Loading branch information
Showing
5 changed files
with
64 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ObservedArray, YTNode } from '../helpers.js'; | ||
import { RawNode } from '../index.js'; | ||
import Parser from '../parser.js'; | ||
import Author from './misc/Author.js'; | ||
import Text from './misc/Text.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
import ShowCustomThumbnail from './ShowCustomThumbnail.js'; | ||
import ThumbnailOverlayBottomPanel from './ThumbnailOverlayBottomPanel.js'; | ||
|
||
export default class GridShow extends YTNode { | ||
static type = 'GridShow'; | ||
|
||
title: Text; | ||
thumbnail_renderer: ShowCustomThumbnail | null; | ||
endpoint: NavigationEndpoint; | ||
long_byline_text: Text; | ||
thumbnail_overlays: ObservedArray<ThumbnailOverlayBottomPanel> | null; | ||
author: Author; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.thumbnail_renderer = Parser.parseItem(data.thumbnailRenderer, ShowCustomThumbnail); | ||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint); | ||
this.long_byline_text = new Text(data.longBylineText); | ||
this.thumbnail_overlays = Parser.parseArray(data.thumbnailOverlays, ThumbnailOverlayBottomPanel); | ||
this.author = new Author(data.shortBylineText, undefined); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { RawNode } from '../index.js'; | ||
import Thumbnail from './misc/Thumbnail.js'; | ||
|
||
export default class ShowCustomThumbnail extends YTNode { | ||
static type = 'ShowCustomThumbnail'; | ||
|
||
thumbnail: Thumbnail[]; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.thumbnail = Thumbnail.fromResponse(data.thumbnail); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters