mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Show failure reason in webook
This commit is contained in:
parent
2fb3d05055
commit
d75b9ddcaa
1 changed files with 3 additions and 3 deletions
|
@ -3,9 +3,9 @@ import { Logger } from "./logger";
|
|||
import { innerTubeVideoDetails } from "../types/innerTubeApi.model";
|
||||
import DiskCache from "./diskCache";
|
||||
|
||||
const privateResponse = (videoId: string): innerTubeVideoDetails => ({
|
||||
const privateResponse = (videoId: string, reason: string): innerTubeVideoDetails => ({
|
||||
videoId,
|
||||
title: "Private video?",
|
||||
title: reason,
|
||||
channelId: "",
|
||||
// exclude video duration
|
||||
isOwnerViewing: false,
|
||||
|
@ -44,7 +44,7 @@ export async function getFromITube (videoID: string): Promise<innerTubeVideoDeta
|
|||
});
|
||||
/* istanbul ignore else */
|
||||
if (result.status === 200) {
|
||||
return result.data?.videoDetails ?? privateResponse(videoID);
|
||||
return result.data?.videoDetails ?? privateResponse(videoID, result.data?.playabilityStatus?.reason ?? "Bad response");
|
||||
} else {
|
||||
return Promise.reject(`Innertube returned non-200 response: ${result.status}`);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue