mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-28 09:06: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/ChannelHeaderLinks.js
Normal file
24
lib/parser/classes/ChannelHeaderLinks.js
Normal file
@@ -0,0 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
const NavigationEndpoint = require('./NavigationEndpoint');
|
||||
const Text = require('./Text');
|
||||
const Thumbnail = require('./Thumbnail');
|
||||
|
||||
class HeaderLink {
|
||||
constructor(data) {
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
||||
this.icon = Thumbnail.fromResponse(data.icon);
|
||||
this.title = new Text(data.title);
|
||||
}
|
||||
}
|
||||
|
||||
class ChannelHeaderLinks {
|
||||
type = 'ChannelHeaderLinks';
|
||||
|
||||
constructor(data) {
|
||||
this.primary = data.primaryLinks?.map((link) => new HeaderLink(link)) || [];
|
||||
this.secondary = data.secondaryLinks?.map((link) => new HeaderLink(link)) || [];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ChannelHeaderLinks;
|
||||
Reference in New Issue
Block a user