-
-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge main into Wykerd-refactor-parser
- Loading branch information
Showing
16 changed files
with
388 additions
and
50 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Parser from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
import Thumbnail from './misc/Thumbnail.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import MetadataBadge from './MetadataBadge.js'; | ||
|
||
class GridMovie extends YTNode { | ||
static type = 'GridMovie'; | ||
|
||
id: string; | ||
title: Text; | ||
thumbnails: Thumbnail[]; | ||
duration: Text | null; | ||
endpoint: NavigationEndpoint; | ||
badges: MetadataBadge[]; | ||
metadata: Text; | ||
thumbnail_overlays; | ||
|
||
constructor(data: any) { | ||
super(); | ||
const length_alt = data.thumbnailOverlays.find((overlay: any) => overlay.hasOwnProperty('thumbnailOverlayTimeStatusRenderer'))?.thumbnailOverlayTimeStatusRenderer; | ||
this.id = data.videoId; | ||
this.title = new Text(data.title); | ||
this.thumbnails = Thumbnail.fromResponse(data.thumbnail); | ||
this.duration = data.lengthText ? new Text(data.lengthText) : length_alt?.text ? new Text(length_alt.text) : null; | ||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint); | ||
this.badges = Parser.parseArray<MetadataBadge>(data.badges, MetadataBadge); | ||
this.metadata = new Text(data.metadata); | ||
this.thumbnail_overlays = Parser.parseArray(data.thumbnailOverlays); | ||
} | ||
} | ||
|
||
export default GridMovie; |
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,25 @@ | ||
import Parser from '../index.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import Button from './Button.js'; | ||
|
||
class HorizontalMovieList extends YTNode { | ||
static type = 'HorizontalMovieList'; | ||
|
||
items; | ||
previous_button: Button | null; | ||
next_button: Button | null; | ||
|
||
constructor(data: any) { | ||
super(); | ||
this.items = Parser.parseArray(data.items); | ||
this.previous_button = Parser.parseItem<Button>(data.previousButton, Button); | ||
this.next_button = Parser.parseItem<Button>(data.nextButton, Button); | ||
} | ||
|
||
// XXX: alias for consistency | ||
get contents() { | ||
return this.items; | ||
} | ||
} | ||
|
||
export default HorizontalMovieList; |
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,27 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import Parser, { RawNode } from '../index.js'; | ||
import InfoPanelContent from './InfoPanelContent.js'; | ||
import Menu from './menus/Menu.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
export default class InfoPanelContainer extends YTNode { | ||
static type = 'InfoPanelContainer'; | ||
|
||
icon_type?: string; | ||
title: Text; | ||
menu: Menu | null; | ||
content: YTNode | null; | ||
background: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.menu = Parser.parseItem(data.menu, Menu); | ||
this.content = Parser.parseItem(data.content, InfoPanelContent); | ||
this.background = data.background; | ||
|
||
if (data.icon?.iconType) { | ||
this.icon_type = data.icon.iconType; | ||
} | ||
} | ||
} |
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,33 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { RawNode } from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
import Thumbnail from './misc/Thumbnail.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
|
||
export default class InfoPanelContent extends YTNode { | ||
static type = 'InfoPanelContent'; | ||
|
||
title: Text; | ||
inline_link_icon_type?: string; | ||
source: Text; | ||
paragraphs: Text[]; | ||
thumbnail: Thumbnail[]; | ||
source_endpoint: NavigationEndpoint; | ||
truncate_paragraphs: boolean; | ||
background: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.title = new Text(data.title); | ||
this.source = new Text(data.source); | ||
this.paragraphs = data.paragraphs.map((p: RawNode) => new Text(p)); | ||
this.thumbnail = Thumbnail.fromResponse(data.thumbnail); | ||
this.source_endpoint = new NavigationEndpoint(data.sourceEndpoint); | ||
this.truncate_paragraphs = !!data.truncateParagraphs; | ||
this.background = data.background; | ||
|
||
if (data.inlineLinkIcon?.iconType) { | ||
this.inline_link_icon_type = data.inlineLinkIcon.iconType; | ||
} | ||
} | ||
} |
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,32 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, RawNode } from '../index.js'; | ||
import YpcTrailer from './YpcTrailer.js'; | ||
|
||
class PlayerLegacyDesktopYpcTrailer extends YTNode { | ||
static type = 'PlayerLegacyDesktopYpcTrailer'; | ||
|
||
video_id: string; | ||
title: string; | ||
thumbnail: string; | ||
offer_headline: string; | ||
offer_description: string; | ||
offer_id: string; | ||
offer_button_text: string; | ||
video_message: string; | ||
trailer: YpcTrailer | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.video_id = data.trailerVideoId; | ||
this.title = data.itemTitle; | ||
this.thumbnail = data.itemThumbnail; | ||
this.offer_headline = data.offerHeadline; | ||
this.offer_description = data.offerDescription; | ||
this.offer_id = data.offerId; | ||
this.offer_button_text = data.offerButtonText; | ||
this.video_message = data.fullVideoMessage; | ||
this.trailer = Parser.parseItem<YpcTrailer>(data.ypcTrailer, YpcTrailer); | ||
} | ||
} | ||
|
||
export default PlayerLegacyDesktopYpcTrailer; |
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
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,17 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { RawNode } from '../index.js'; | ||
|
||
class YpcTrailer extends YTNode { | ||
static type = 'YpcTrailer'; | ||
|
||
video_message: string; | ||
player_response; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
this.video_message = data.fullVideoMessage; | ||
this.player_response = data.unserializedPlayerResponse; | ||
} | ||
} | ||
|
||
export default YpcTrailer; |
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
Oops, something went wrong.