invidious-companion-patches/patches/0014-metrics-add-more-errors.patch
Fijxu 0f8f95b87e
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 12s
add 0018 and 0019
2025-04-22 15:43:05 -04:00

99 lines
3.6 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 3a8cd40bd348abb514244228a0f43c054f9fbfc8 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Mon, 14 Apr 2025 01:25:40 -0400
Subject: [PATCH 14/19] metrics: add more errors
Added reason and subreason for sentitive content videos ("CONTENT_CHECK_REQUIRED")
fix: fix typo: `SignInToConfirmBot` -> `signInToConfirmBot`
---
src/lib/helpers/metrics.ts | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/src/lib/helpers/metrics.ts b/src/lib/helpers/metrics.ts
index 2464fe7..e1b0b73 100644
--- a/src/lib/helpers/metrics.ts
+++ b/src/lib/helpers/metrics.ts
@@ -116,24 +116,32 @@ export class Metrics {
interface Error {
signInToConfirmAge: boolean;
- SignInToConfirmBot: boolean;
+ signInToConfirmBot: boolean;
+ selfHarmTopics: boolean;
unknown: string | undefined;
}
const error: Error = {
signInToConfirmAge: false,
- SignInToConfirmBot: false,
+ signInToConfirmBot: false,
+ selfHarmTopics: false,
unknown: undefined,
};
switch (true) {
case reason?.includes("Sign in to confirm youre not a bot"):
- error.SignInToConfirmBot = true;
+ error.signInToConfirmBot = true;
return error;
// Age restricted videos
case reason?.includes("Sign in to confirm your age"):
error.signInToConfirmAge = true;
return error;
+ // For videos with playabilityStatus.status == `CONTENT_CHECK_REQUIRED`
+ case reason?.includes(
+ "The following content may contain suicide or self-harm topics",
+ ):
+ error.selfHarmTopics = true;
+ return error;
default:
error.unknown = reason;
return error;
@@ -147,11 +155,15 @@ export class Metrics {
interface Error {
thisHelpsProtectCommunity: boolean;
+ thisVideoMayBeInnapropiate: boolean;
+ viewerDiscretionAdvised: boolean;
unknown: string | undefined;
}
const error: Error = {
thisHelpsProtectCommunity: false,
+ thisVideoMayBeInnapropiate: false,
+ viewerDiscretionAdvised: false,
unknown: undefined,
};
@@ -159,6 +171,18 @@ export class Metrics {
case subReason?.includes("This helps protect our community"):
error.thisHelpsProtectCommunity = true;
return error;
+ // Age restricted videos
+ case subReason?.includes(
+ "This video may be inappropriate for some users",
+ ):
+ error.thisVideoMayBeInnapropiate = true;
+ return error;
+ // For videos with playabilityStatus.status == `CONTENT_CHECK_REQUIRED`
+ case subReason?.includes(
+ "Viewer discretion is advised",
+ ):
+ error.viewerDiscretionAdvised = true;
+ return error;
default:
error.unknown = subReason;
return error;
@@ -199,7 +223,7 @@ export class Metrics {
if (status.loginRequired) {
this.innertubeErrorStatusLoginRequired.inc();
- if (reason.SignInToConfirmBot) {
+ if (reason.signInToConfirmBot) {
this.innertubeErrorReasonSignIn.inc();
if (subReason.thisHelpsProtectCommunity) {
--
2.49.0