YouTube : Completed

This commit is contained in:
killer069
2021-08-13 13:16:34 +05:30
parent 455c7dfb69
commit 04770cc929
10 changed files with 215 additions and 76 deletions

View File

@@ -6,10 +6,10 @@ export interface ChannelIconInterface {
export class Channel {
name?: string;
verified!: boolean;
verified?: boolean;
id?: string;
url?: string;
icon!: ChannelIconInterface;
icon?: ChannelIconInterface;
subscribers?: string;
constructor(data: any) {
@@ -36,7 +36,7 @@ export class Channel {
*/
iconURL(options = { size: 0 }): string | undefined{
if (typeof options.size !== "number" || options.size < 0) throw new Error("invalid icon size");
if (!this.icon.url) return undefined;
if (!this.icon?.url) return undefined;
const def = this.icon.url.split("=s")[1].split("-c")[0];
return this.icon.url.replace(`=s${def}-c`, `=s${options.size}-c`);
}