mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
refactor: migrate parsers to TS (#133)
* dev: finish top-level parsers TS migration
* dev: migrate menu renderers to TS
* chore: fix ts errors
* dev: finish ts migration 🎉
This commit is contained in:
32
src/parser/classes/Channel.ts
Normal file
32
src/parser/classes/Channel.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import Author from './misc/Author';
|
||||
import NavigationEndpoint from './NavigationEndpoint';
|
||||
import Text from './misc/Text';
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class Channel extends YTNode {
|
||||
static type = 'Channel';
|
||||
|
||||
id: string;
|
||||
author: Author;
|
||||
subscribers: Text;
|
||||
videos: Text;
|
||||
endpoint: NavigationEndpoint;
|
||||
description_snippet: Text;
|
||||
|
||||
constructor(data: any) {
|
||||
super();
|
||||
this.id = data.channelId;
|
||||
|
||||
this.author = new Author({
|
||||
...data.title,
|
||||
navigationEndpoint: data.navigationEndpoint
|
||||
}, data.ownerBadges, data.thumbnail);
|
||||
|
||||
this.subscribers = new Text(data.subscriberCountText);
|
||||
this.videos = new Text(data.videoCountText);
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
||||
this.description_snippet = new Text(data.descriptionSnippet);
|
||||
}
|
||||
}
|
||||
|
||||
export default Channel;
|
||||
Reference in New Issue
Block a user