Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Assign MetaDataBadge's label #311

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/parser/classes/CompactVideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ class CompactVideo extends YTNode {
}

get is_fundraiser(): boolean {
return this.badges.some((badge) => badge.style === 'Fundraiser');
return this.badges.some((badge) => badge.label === 'Fundraiser');
}

get is_live(): boolean {
return this.badges.some((badge) => {
if (badge.label === 'BADGE_STYLE_TYPE_LIVE_NOW' || badge.style === 'LIVE')
if (badge.style === 'BADGE_STYLE_TYPE_LIVE_NOW' || badge.label === 'LIVE')
return true;
});
}

get is_new(): boolean {
return this.badges.some((badge) => badge.style === 'New');
return this.badges.some((badge) => badge.label === 'New');
}

get is_premiere(): boolean {
Expand Down
2 changes: 1 addition & 1 deletion src/parser/classes/MetadataBadge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MetadataBadge extends YTNode {
}

if (data?.label) {
this.style = data.label;
this.label = data.label;
}

if (data?.tooltip || data?.iconTooltip) {
Expand Down
8 changes: 4 additions & 4 deletions src/parser/classes/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Video extends YTNode {

get is_live(): boolean {
return this.badges.some((badge) => {
if (badge.label === 'BADGE_STYLE_TYPE_LIVE_NOW' || badge.style === 'LIVE')
if (badge.style === 'BADGE_STYLE_TYPE_LIVE_NOW' || badge.label === 'LIVE')
return true;
});
}
Expand All @@ -106,15 +106,15 @@ class Video extends YTNode {
}

get is_premiere(): boolean {
return this.badges.some((badge) => badge.style === 'PREMIERE');
return this.badges.some((badge) => badge.label === 'PREMIERE');
}

get is_4k(): boolean {
return this.badges.some((badge) => badge.style === '4K');
return this.badges.some((badge) => badge.label === '4K');
}

get has_captions(): boolean {
return this.badges.some((badge) => badge.style === 'CC');
return this.badges.some((badge) => badge.label === 'CC');
}

get best_thumbnail(): Thumbnail | undefined {
Expand Down