mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-26 16:18:51 +00:00
refactor!: finish parser migration
Finally! :) This removes all code related to the old parser. #65
This commit is contained in:
24
lib/parser/classes/SubscribeButton.js
Normal file
24
lib/parser/classes/SubscribeButton.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const Parser = require('..');
|
||||
const Text = require('./Text');
|
||||
const NavigationEndpoint = require('./NavigationEndpoint');
|
||||
|
||||
class SubscribeButton {
|
||||
type = 'SubscribeButton';
|
||||
|
||||
constructor(data) {
|
||||
this.title = new Text(data.buttonText);
|
||||
this.subscribed = data.subscribed;
|
||||
this.enabled = data.enabled;
|
||||
this.type = data.type;
|
||||
this.channel_id = data.channelId;
|
||||
this.show_preferences = data.showPreferences;
|
||||
this.subscribed_text = new Text(data.subscribedButtonText);
|
||||
this.unsubscribed_text = new Text(data.unsubscribedButtonText);
|
||||
this.notification_preference_button = Parser.parse(data.notificationPreferenceButton);
|
||||
this.endpoint = new NavigationEndpoint(data.serviceEndpoints?.[0] || data.onSubscribeEndpoints?.[0]);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SubscribeButton;
|
||||
Reference in New Issue
Block a user