mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-12 18:04:29 +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 { 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}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue