From ec82de3c5f5ea8372a7a92bbdc0e516f91f4705e Mon Sep 17 00:00:00 2001 From: Priveetee Date: Sat, 18 Apr 2026 08:02:48 +0200 Subject: [PATCH 1/2] fix: stop mapping bot-check prompts to members-only --- .../typetype/server/services/ExtractionErrorSanitizer.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/kotlin/dev/typetype/server/services/ExtractionErrorSanitizer.kt b/src/main/kotlin/dev/typetype/server/services/ExtractionErrorSanitizer.kt index a4fb60a..aabbb07 100644 --- a/src/main/kotlin/dev/typetype/server/services/ExtractionErrorSanitizer.kt +++ b/src/main/kotlin/dev/typetype/server/services/ExtractionErrorSanitizer.kt @@ -2,22 +2,31 @@ package dev.typetype.server.services object ExtractionErrorSanitizer { private const val MEMBERS_ONLY = "This video is only available for members" + private const val SIGN_IN_REQUIRED = "Sign in is required to verify access to this video" fun sanitize(raw: String?): String? { if (raw.isNullOrBlank()) return null val compact = raw.replace('\n', ' ').replace('\r', ' ').trim() if (compact.isBlank()) return null if (isMembersOnlyPrompt(compact)) return MEMBERS_ONLY + if (isSignInVerificationPrompt(compact)) return SIGN_IN_REQUIRED return compact } private fun isMembersOnlyPrompt(message: String): Boolean { val lowered = message.lowercase() if ("members" in lowered && "only available" in lowered) return true + if ("join this channel" in lowered && "members-only" in lowered) return true + return false + } + + private fun isSignInVerificationPrompt(message: String): Boolean { + val lowered = message.lowercase() if ("sign in to confirm" in lowered) return true if ("not a bot" in lowered) return true if ("qinisekisa ukuthi" in lowered) return true if ("awuyona i-bot" in lowered) return true + if ("ngena ngemvume" in lowered) return true return false } } From ecf16e93f482af0f7e1c09833dc98a66ca2f1a1d Mon Sep 17 00:00:00 2001 From: Priveetee Date: Sat, 18 Apr 2026 08:02:54 +0200 Subject: [PATCH 2/2] test: cover sign-in prompt sanitizer behavior --- .../typetype/server/ExtractionErrorSanitizerTest.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/kotlin/dev/typetype/server/ExtractionErrorSanitizerTest.kt b/src/test/kotlin/dev/typetype/server/ExtractionErrorSanitizerTest.kt index aaa3d20..8a53f4f 100644 --- a/src/test/kotlin/dev/typetype/server/ExtractionErrorSanitizerTest.kt +++ b/src/test/kotlin/dev/typetype/server/ExtractionErrorSanitizerTest.kt @@ -6,10 +6,10 @@ import org.junit.jupiter.api.Test class ExtractionErrorSanitizerTest { @Test - fun `normalizes bot prompt with mixed locales`() { + fun `normalizes bot prompt with mixed locales to sign-in verification message`() { val raw = "Ngena ngemvume ukuze uqinisekise ukuthi awuyona i-bot" assertEquals( - "This video is only available for members", + "Sign in is required to verify access to this video", ExtractionErrorSanitizer.sanitize(raw), ) } @@ -21,8 +21,14 @@ class ExtractionErrorSanitizerTest { } @Test - fun `normalizes login confirm prompt to members only message`() { + fun `normalizes login confirm prompt to sign-in verification message`() { val raw = "Sign in to confirm you are not a bot" + assertEquals("Sign in is required to verify access to this video", ExtractionErrorSanitizer.sanitize(raw)) + } + + @Test + fun `keeps members-only paywall prompt as members message`() { + val raw = "Join this channel to get access to members-only content like this video" assertEquals("This video is only available for members", ExtractionErrorSanitizer.sanitize(raw)) }