From 5465963650063ae11fe1826a781172e53dcd2439 Mon Sep 17 00:00:00 2001 From: Artemy Date: Wed, 9 Aug 2023 19:35:58 +0300 Subject: [PATCH] feat: channel tabs --- package-lock.json | 4 ++-- package.json | 2 +- src/index.ts | 5 +++++ src/types.ts | 14 ++++++++++++++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1529a86..a3d647c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "piped-api", - "version": "1.1.6", + "version": "1.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "piped-api", - "version": "1.1.6", + "version": "1.2.0", "license": "MIT", "dependencies": { "axios": "^1.4.0" diff --git a/package.json b/package.json index 10f8be1..946e4b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "piped-api", - "version": "1.1.6", + "version": "1.2.0", "description": "", "main": "dist/index.js", "type": "module", diff --git a/src/index.ts b/src/index.ts index 6ea3c3f..3e9819f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,7 @@ import { Search, Sponsors, Streams, + Tab, Video, } from "./types"; @@ -77,6 +78,10 @@ export class PipedAPI { : await this._get(`/channel/${id}`); } + async channelTabs(data: string): Promise { + return await this._get(`/channels/tabs/?data=${data}`); + } + /** * Retrieves a channel by its name. * diff --git a/src/types.ts b/src/types.ts index cd41756..3f8ba2d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -102,6 +102,7 @@ export interface Channel { description: string; id: string; name: string; + tabs: TabInfo[]; nextpage: string; relatedStreams: Video[]; subscriberCount: number; @@ -109,6 +110,18 @@ export interface Channel { type?: string; } +export interface TabInfo { + name: string; + data: string; +} + +export interface Tab { + nextpage: string; + content: TabResp[]; +} + +export type TabResp = Video | Channel | Playlist; + export interface NextPageChannel { nextpage: string; relatedStreams: Video[]; @@ -124,6 +137,7 @@ export interface Playlist { uploaderAvatar: string; uploaderUrl: string; videos: number; + type?: string; } export interface NextPagePlaylist {