invidious-companion-patches/patches/0013-metrics-add-more-errors.patch
Fijxu 5553757d97
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m3s
updated patches and invidious-companion
2025-04-24 18:10:53 -04:00

99 lines
3.6 KiB
Diff
Raw Permalink 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 64300c43e8dd5269d1c3d173d0ebd62b607b09ce Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Mon, 14 Apr 2025 01:25:40 -0400
Subject: [PATCH 13/17] 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