Skip to content

Commit

Permalink
chore(Parser): Don't ignore BackgroundPromo
Browse files Browse the repository at this point in the history
It turns out this is not an ad at all.
  • Loading branch information
LuanRT committed Dec 10, 2024
1 parent 67f13ff commit c1de097
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/core/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export default class Actions {
if (this.#needsLogin(data.browseId) && !this.session.logged_in)
throw new InnertubeError('You must be signed in to perform this operation.');
}

if (Reflect.has(data, 'skip_auth_check'))
delete data.skip_auth_check;

if (Reflect.has(data, 'override_endpoint'))
delete data.override_endpoint;
Expand Down
25 changes: 25 additions & 0 deletions src/parser/classes/BackgroundPromo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { YTNode } from '../helpers.js';
import { Parser, type RawNode } from '../index.js';
import Text from './misc/Text.js';
import Button from './Button.js';
import ButtonView from './ButtonView.js';

export default class BackgroundPromo extends YTNode {
static type = 'BackgroundPromo';

public body_text?: Text;
public cta_button?: Button | ButtonView | null;
public icon_type?: string;
public title?: Text;

constructor(data: RawNode) {
super();
this.body_text = new Text(data.bodyText);
this.cta_button = Parser.parseItem(data.ctaButton, [ Button, ButtonView ]);

if (Reflect.has(data, 'icon'))
this.icon_type = data.icon.iconType;

this.title = new Text(data.title);
}
}
1 change: 1 addition & 0 deletions src/parser/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export { default as AttributionView } from './classes/AttributionView.js';
export { default as AudioOnlyPlayability } from './classes/AudioOnlyPlayability.js';
export { default as AutomixPreviewVideo } from './classes/AutomixPreviewVideo.js';
export { default as AvatarView } from './classes/AvatarView.js';
export { default as BackgroundPromo } from './classes/BackgroundPromo.js';
export { default as BackstageImage } from './classes/BackstageImage.js';
export { default as BackstagePost } from './classes/BackstagePost.js';
export { default as BackstagePostThread } from './classes/BackstagePostThread.js';
Expand Down
1 change: 0 additions & 1 deletion src/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const IGNORED_LIST = new Set([
'SearchPyv',
'MealbarPromo',
'PrimetimePromo',
'BackgroundPromo',
'PromotedSparklesWeb',
'CompactPromotedVideo',
'BrandVideoShelf',
Expand Down

0 comments on commit c1de097

Please sign in to comment.