Skip to content

Commit

Permalink
fix: assign MetadataBadge's label (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkyProgrammer authored Feb 13, 2023
1 parent 567fdba commit e37cf62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit e37cf62

Please sign in to comment.