Files
YouTube.js/lib/parser/contents/classes/C4TabbedHeader.js
LuanRT 1d62e469a9 refactor: rewrite Comments Section logic (#88)
* feat: add core comments section classes

* chore: update type declarations

* chore: fix linter warnings

* style: fix linter

* chore: update tests

* chore(tests): fix typo

* chore(tests): fix typo x2

* fix(tests): `getReplies()` method is only present in `CommentThread` and not `Comment`

* chore(tests): fix comment id path

* chore(tests): remove outdated code

* chore(tests): fix results path

* chore: enforce code style

* chore: update type declarations

* docs: add examples and documentation

* chore(docs): fix paths

* chore(docs): fix more paths

* chore(docs): fix `Comments.js` path

* chore(docs): fix typo

* chore(docs): mention example file

* chore(examples): fix imports

* chore(examples): fix typo
2022-07-02 19:55:33 -03:00

27 lines
967 B
JavaScript

'use strict';
const Parser = require('..');
const Author = require('./Author');
const Thumbnail = require('./Thumbnail');
const Text = require('./Text');
class C4TabbedHeader {
type = 'C4TabbedHeader';
constructor(data) {
this.author = new Author({
simpleText: data.title,
navigationEndpoint: data.navigationEndpoint
}, data.badges, data.avatar);
this.banner = data.banner ? Thumbnail.fromResponse(data.banner) : [];
this.tv_banner = data.tvBanner ? Thumbnail.fromResponse(data.tvBanner) : [];
this.mobile_banner = data.mobileBanner ? Thumbnail.fromResponse(data.mobileBanner) : [];
this.subscribers = new Text(data.subscriberCountText);
this.sponsor_button = data.sponsorButton && Parser.parse(data.sponsorButton);
this.subscribe_button = data.subscribeButton && Parser.parse(data.subscribeButton);
this.header_links = data.headerLinks && Parser.parse(data.headerLinks);
}
}
module.exports = C4TabbedHeader;