mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 03:57:06 +03:00
Show failure reason in webook
This commit is contained in:
@@ -3,9 +3,9 @@ import { Logger } from "./logger";
|
|||||||
import { innerTubeVideoDetails } from "../types/innerTubeApi.model";
|
import { innerTubeVideoDetails } from "../types/innerTubeApi.model";
|
||||||
import DiskCache from "./diskCache";
|
import DiskCache from "./diskCache";
|
||||||
|
|
||||||
const privateResponse = (videoId: string): innerTubeVideoDetails => ({
|
const privateResponse = (videoId: string, reason: string): innerTubeVideoDetails => ({
|
||||||
videoId,
|
videoId,
|
||||||
title: "Private video?",
|
title: reason,
|
||||||
channelId: "",
|
channelId: "",
|
||||||
// exclude video duration
|
// exclude video duration
|
||||||
isOwnerViewing: false,
|
isOwnerViewing: false,
|
||||||
@@ -44,7 +44,7 @@ export async function getFromITube (videoID: string): Promise<innerTubeVideoDeta
|
|||||||
});
|
});
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (result.status === 200) {
|
if (result.status === 200) {
|
||||||
return result.data?.videoDetails ?? privateResponse(videoID);
|
return result.data?.videoDetails ?? privateResponse(videoID, result.data?.playabilityStatus?.reason ?? "Bad response");
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(`Innertube returned non-200 response: ${result.status}`);
|
return Promise.reject(`Innertube returned non-200 response: ${result.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user