feat: channel tabs

This commit is contained in:
Artemy 2023-08-09 19:35:58 +03:00
parent a37588554b
commit 5465963650
4 changed files with 22 additions and 3 deletions

4
package-lock.json generated
View file

@ -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"

View file

@ -1,6 +1,6 @@
{
"name": "piped-api",
"version": "1.1.6",
"version": "1.2.0",
"description": "",
"main": "dist/index.js",
"type": "module",

View file

@ -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<Tab> {
return await this._get(`/channels/tabs/?data=${data}`);
}
/**
* Retrieves a channel by its name.
*

View file

@ -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 {