All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 1m45s
99 lines
3.6 KiB
Diff
99 lines
3.6 KiB
Diff
From b7df5e38e499652dbcc550d8ec6e0ec453bec04f Mon Sep 17 00:00:00 2001
|
||
From: Fijxu <fijxu@nadeko.net>
|
||
Date: Mon, 14 Apr 2025 01:25:40 -0400
|
||
Subject: [PATCH 14/16] 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 you’re 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
|
||
|