From 9cb9099807975cc369d825e9b9980b9fba14571f Mon Sep 17 00:00:00 2001 From: Ashley //// Date: Thu, 14 Mar 2024 17:21:51 +0000 Subject: [PATCH] make loading faster --- src/libpoketube/libpoketube-core.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/libpoketube/libpoketube-core.js b/src/libpoketube/libpoketube-core.js index e0c73630..5b057561 100644 --- a/src/libpoketube/libpoketube-core.js +++ b/src/libpoketube/libpoketube-core.js @@ -66,7 +66,7 @@ class InnerTubePokeVidious { * @param {string} v - Video ID. * @returns {Promise} Promise resolving to the video information. */ - async getYouTubeApiVideo(v, contentlang, contentregion) { + async getYouTubeApiVideo(f, v, contentlang, contentregion) { const { fetch } = await import("undici"); @@ -99,10 +99,13 @@ class InnerTubePokeVidious { const vid = await this.getJson(videoInfo); const { json, video } = videoData; - const channel_uploads = await fetch( - `${this.config.invapi}/channels/${vid.authorId}?hl=${contentlang}®ion=${contentregion}` - ); - const p = this.getJson(await channel_uploads.text()); + let channel_uploads = null; + if (f) { + channel_uploads = await fetch( + `${this.config.invapi}/channels/${vid.authorId}?hl=${contentlang}®ion=${contentregion}` + ); + channel_uploads = this.getJson(await channel_uploads.text()); + } if (!vid) { console.log( @@ -123,7 +126,7 @@ class InnerTubePokeVidious { video, vid, comments, - channel_uploads:p, + channel_uploads, engagement: fe.engagement, wiki: "", desc: "",