mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +00:00
chore: v5.0.0 release
This commit is contained in:
@@ -1,28 +1,25 @@
|
||||
import Parser from '../index.ts';
|
||||
|
||||
import Text from './misc/Text.ts';
|
||||
import Author from './misc/Author.ts';
|
||||
import NavigationEndpoint from './NavigationEndpoint.ts';
|
||||
|
||||
import SubscribeButton from './SubscribeButton.ts';
|
||||
import Button from './Button.ts';
|
||||
|
||||
import { YTNode } from '../helpers.ts';
|
||||
import Parser, { type RawNode } from '../index.ts';
|
||||
import Button from './Button.ts';
|
||||
import NavigationEndpoint from './NavigationEndpoint.ts';
|
||||
import SubscribeButton from './SubscribeButton.ts';
|
||||
import Author from './misc/Author.ts';
|
||||
import Text from './misc/Text.ts';
|
||||
|
||||
class Channel extends YTNode {
|
||||
export default class Channel extends YTNode {
|
||||
static type = 'Channel';
|
||||
|
||||
id: string;
|
||||
author: Author;
|
||||
subscribers: Text;
|
||||
videos: Text;
|
||||
subscriber_count: Text;
|
||||
video_count: Text;
|
||||
long_byline: Text;
|
||||
short_byline: Text;
|
||||
endpoint: NavigationEndpoint;
|
||||
subscribe_button: SubscribeButton | Button | null;
|
||||
description_snippet: Text;
|
||||
|
||||
constructor(data: any) {
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.id = data.channelId;
|
||||
|
||||
@@ -31,15 +28,31 @@ class Channel extends YTNode {
|
||||
navigationEndpoint: data.navigationEndpoint
|
||||
}, data.ownerBadges, data.thumbnail);
|
||||
|
||||
// TODO: subscriberCountText is now the channel's handle and videoCountText is the subscriber count. Why haven't they renamed the properties?
|
||||
this.subscribers = new Text(data.subscriberCountText);
|
||||
this.videos = new Text(data.videoCountText);
|
||||
// XXX: `subscriberCountText` is now the channel's handle and `videoCountText` is the subscriber count.
|
||||
this.subscriber_count = new Text(data.subscriberCountText);
|
||||
this.video_count = new Text(data.videoCountText);
|
||||
this.long_byline = new Text(data.longBylineText);
|
||||
this.short_byline = new Text(data.shortBylineText);
|
||||
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
||||
this.subscribe_button = Parser.parseItem(data.subscribeButton, [ SubscribeButton, Button ]);
|
||||
this.description_snippet = new Text(data.descriptionSnippet);
|
||||
}
|
||||
}
|
||||
|
||||
export default Channel;
|
||||
/**
|
||||
* @deprecated
|
||||
* This will be removed in a future release.
|
||||
* Please use {@link Channel.subscriber_count} instead.
|
||||
*/
|
||||
get subscribers(): Text {
|
||||
return this.subscriber_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* This will be removed in a future release.
|
||||
* Please use {@link Channel.video_count} instead.
|
||||
*/
|
||||
get videos(): Text {
|
||||
return this.video_count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user