Files
YouTube.js/src/parser/classes/MerchandiseItem.ts
LuanRT 257bd475a0 refactor: clean up parser and tests (#387)
* tests: improve coverage

* refactor: clean up nodes

* chore: lint

* feat(parser): ignore `BrandVideoShelf`

Seems to be used for ads.

* feat(parser): ignore `BrandVideoSingleton` too
2023-04-23 06:37:33 -03:00

35 lines
1.1 KiB
TypeScript

import Thumbnail from './misc/Thumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
export default class MerchandiseItem extends YTNode {
static type = 'MerchandiseItem';
title: string;
description: string;
thumbnails: Thumbnail[];
price: string;
vendor_name: string;
button_text: string;
button_accessibility_text: string;
from_vendor_text: string;
additional_fees_text: string;
region_format: string;
endpoint: NavigationEndpoint;
constructor(data: RawNode) {
super();
this.title = data.title;
this.description = data.description;
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
this.price = data.price;
this.vendor_name = data.vendorName;
this.button_text = data.buttonText;
this.button_accessibility_text = data.buttonAccessibilityText;
this.from_vendor_text = data.fromVendorText;
this.additional_fees_text = data.additionalFeesText;
this.region_format = data.regionFormat;
this.endpoint = new NavigationEndpoint(data.buttonCommand);
}
}