-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Channel): Support new about popup (#537)
* feat(Channel): Support new about popup * chore: Minor cleanup * fix(concatMemos): Merge duplicate nodes instead of overwriting * fix(Feed): `has_continuation` and `getContinuation()` avoid header continuations * chore(Channel): Remove unused import --------- Co-authored-by: LuanRT <[email protected]>
- Loading branch information
Showing
12 changed files
with
253 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import AboutChannelView from './AboutChannelView.js'; | ||
import Button from './Button.js'; | ||
|
||
export default class AboutChannel extends YTNode { | ||
static type = 'AboutChannel'; | ||
|
||
metadata: AboutChannelView | null; | ||
share_channel: Button | null; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
this.metadata = Parser.parseItem(data.metadata, AboutChannelView); | ||
this.share_channel = Parser.parseItem(data.shareChannel, Button); | ||
} | ||
} |
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,87 @@ | ||
import type { ObservedArray } from '../helpers.js'; | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import ChannelExternalLinkView from './ChannelExternalLinkView.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
import Text from './misc/Text.js'; | ||
|
||
export default class AboutChannelView extends YTNode { | ||
static type = 'AboutChannelView'; | ||
|
||
description?: string; | ||
description_label?: Text; | ||
country?: string; | ||
custom_links_label?: Text; | ||
subscriber_count?: string; | ||
view_count?: string; | ||
joined_date?: Text; | ||
canonical_channel_url?: string; | ||
channel_id?: string; | ||
additional_info_label?: Text; | ||
custom_url_on_tap?: NavigationEndpoint; | ||
video_count?: string; | ||
sign_in_for_business_email?: Text; | ||
links: ObservedArray<ChannelExternalLinkView>; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
if (Reflect.has(data, 'description')) { | ||
this.description = data.description; | ||
} | ||
|
||
if (Reflect.has(data, 'descriptionLabel')) { | ||
this.description_label = Text.fromAttributed(data.descriptionLabel); | ||
} | ||
|
||
if (Reflect.has(data, 'country')) { | ||
this.country = data.country; | ||
} | ||
|
||
if (Reflect.has(data, 'customLinksLabel')) { | ||
this.custom_links_label = Text.fromAttributed(data.customLinksLabel); | ||
} | ||
|
||
if (Reflect.has(data, 'subscriberCountText')) { | ||
this.subscriber_count = data.subscriberCountText; | ||
} | ||
|
||
if (Reflect.has(data, 'viewCountText')) { | ||
this.view_count = data.viewCountText; | ||
} | ||
|
||
if (Reflect.has(data, 'joinedDateText')) { | ||
this.joined_date = Text.fromAttributed(data.joinedDateText); | ||
} | ||
|
||
if (Reflect.has(data, 'canonicalChannelUrl')) { | ||
this.canonical_channel_url = data.canonicalChannelUrl; | ||
} | ||
|
||
if (Reflect.has(data, 'channelId')) { | ||
this.channel_id = data.channelId; | ||
} | ||
|
||
if (Reflect.has(data, 'additionalInfoLabel')) { | ||
this.additional_info_label = Text.fromAttributed(data.additionalInfoLabel); | ||
} | ||
|
||
if (Reflect.has(data, 'customUrlOnTap')) { | ||
this.custom_url_on_tap = new NavigationEndpoint(data.customUrlOnTap); | ||
} | ||
|
||
if (Reflect.has(data, 'videoCountText')) { | ||
this.video_count = data.videoCountText; | ||
} | ||
|
||
if (Reflect.has(data, 'signInForBusinessEmail')) { | ||
this.sign_in_for_business_email = Text.fromAttributed(data.signInForBusinessEmail); | ||
} | ||
|
||
if (Reflect.has(data, 'links')) { | ||
this.links = Parser.parseArray(data.links, ChannelExternalLinkView); | ||
} else { | ||
this.links = [] as unknown as ObservedArray<ChannelExternalLinkView>; | ||
} | ||
} | ||
} |
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,20 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import type { RawNode } from '../index.js'; | ||
import Text from './misc/Text.js'; | ||
import Thumbnail from './misc/Thumbnail.js'; | ||
|
||
export default class ChannelExternalLinkView extends YTNode { | ||
static type = 'ChannelExternalLinkView'; | ||
|
||
title: Text; | ||
link: Text; | ||
favicon: Thumbnail[]; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
this.title = Text.fromAttributed(data.title); | ||
this.link = Text.fromAttributed(data.link); | ||
this.favicon = data.favicon.sources.map((x: any) => new Thumbnail(x)).sort((a: Thumbnail, b: Thumbnail) => b.width - a.width); | ||
} | ||
} |
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,44 @@ | ||
import { YTNode } from '../helpers.js'; | ||
import { Parser, type RawNode } from '../index.js'; | ||
import NavigationEndpoint from './NavigationEndpoint.js'; | ||
import EngagementPanelSectionList from './EngagementPanelSectionList.js'; | ||
|
||
export default class ChannelTagline extends YTNode { | ||
static type = 'ChannelTagline'; | ||
|
||
content: string; | ||
max_lines: number; | ||
more_endpoint: { | ||
show_engagement_panel_endpoint: { | ||
engagement_panel: EngagementPanelSectionList | null, | ||
engagement_panel_popup_type: string; | ||
identifier: { | ||
surface: string, | ||
tag: string | ||
} | ||
} | ||
} | NavigationEndpoint; | ||
more_icon_type: string; | ||
more_label: string; | ||
target_id: string; | ||
|
||
constructor(data: RawNode) { | ||
super(); | ||
|
||
this.content = data.content; | ||
this.max_lines = data.maxLines; | ||
this.more_endpoint = data.moreEndpoint.showEngagementPanelEndpoint ? { | ||
show_engagement_panel_endpoint: { | ||
engagement_panel: Parser.parseItem(data.moreEndpoint.showEngagementPanelEndpoint.engagementPanel, EngagementPanelSectionList), | ||
engagement_panel_popup_type: data.moreEndpoint.showEngagementPanelEndpoint.engagementPanelPresentationConfigs.engagementPanelPopupPresentationConfig.popupType, | ||
identifier: { | ||
surface: data.moreEndpoint.showEngagementPanelEndpoint.identifier.surface, | ||
tag: data.moreEndpoint.showEngagementPanelEndpoint.identifier.tag | ||
} | ||
} | ||
} : new NavigationEndpoint(data.moreEndpoint); | ||
this.more_icon_type = data.moreIcon.iconType; | ||
this.more_label = data.moreLabel; | ||
this.target_id = data.targetId; | ||
} | ||
} |
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
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