invidious-companion-patches/patches/0014-metrics-add-more-errors.patch
Fijxu a47a5e5cd5
All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m7s
add 0013-metrics-track-unidentified-innertube-errors.patch and 0014-metrics-add-more-errors.patch
2025-04-15 19:38:33 -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 f99728a40b9950a1130d99ee2a6ef29768f3afc9 Mon Sep 17 00:00:00 2001
From: Fijxu <fijxu@nadeko.net>
Date: Mon, 14 Apr 2025 01:25:40 -0400
Subject: [PATCH 14/15] 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