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", "name": "piped-api",
"version": "1.1.6", "version": "1.2.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "piped-api", "name": "piped-api",
"version": "1.1.6", "version": "1.2.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^1.4.0" "axios": "^1.4.0"

View file

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

View file

@ -8,6 +8,7 @@ import {
Search, Search,
Sponsors, Sponsors,
Streams, Streams,
Tab,
Video, Video,
} from "./types"; } from "./types";
@ -77,6 +78,10 @@ export class PipedAPI {
: await this._get(`/channel/${id}`); : 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. * Retrieves a channel by its name.
* *

View file

@ -102,6 +102,7 @@ export interface Channel {
description: string; description: string;
id: string; id: string;
name: string; name: string;
tabs: TabInfo[];
nextpage: string; nextpage: string;
relatedStreams: Video[]; relatedStreams: Video[];
subscriberCount: number; subscriberCount: number;
@ -109,6 +110,18 @@ export interface Channel {
type?: string; 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 { export interface NextPageChannel {
nextpage: string; nextpage: string;
relatedStreams: Video[]; relatedStreams: Video[];
@ -124,6 +137,7 @@ export interface Playlist {
uploaderAvatar: string; uploaderAvatar: string;
uploaderUrl: string; uploaderUrl: string;
videos: number; videos: number;
type?: string;
} }
export interface NextPagePlaylist { export interface NextPagePlaylist {