diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/SpoofClientPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/SpoofClientPatch.kt
index 642e335db..f7423e2a7 100644
--- a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/SpoofClientPatch.kt
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/SpoofClientPatch.kt
@@ -14,6 +14,7 @@ import app.revanced.patches.youtube.utils.compatibility.Constants
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildInitPlaybackRequestFingerprint
import app.revanced.patches.youtube.utils.fix.client.fingerprints.BuildPlayerRequestURIFingerprint
import app.revanced.patches.youtube.utils.fix.client.fingerprints.CreatePlayerRequestBodyFingerprint
+import app.revanced.patches.youtube.utils.fix.client.fingerprints.NerdsStatsVideoFormatBuilderFingerprint
import app.revanced.patches.youtube.utils.fix.client.fingerprints.PlayerGestureConfigSyntheticFingerprint
import app.revanced.patches.youtube.utils.fix.client.fingerprints.SetPlayerRequestClientTypeFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.MISC_PATH
@@ -58,6 +59,9 @@ object SpoofClientPatch : BaseBytecodePatch(
// Player gesture config.
PlayerGestureConfigSyntheticFingerprint,
+
+ // Nerds stats video format.
+ NerdsStatsVideoFormatBuilderFingerprint,
)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
@@ -251,6 +255,27 @@ object SpoofClientPatch : BaseBytecodePatch(
// endregion
+ // region append spoof info
+
+ NerdsStatsVideoFormatBuilderFingerprint.resultOrThrow().mutableMethod.apply {
+ for (index in implementation!!.instructions.size - 1 downTo 0) {
+ val instruction = getInstruction(index)
+ if (instruction.opcode != Opcode.RETURN_OBJECT)
+ continue
+
+ val register = (instruction as OneRegisterInstruction).registerA
+
+ addInstructions(
+ index, """
+ invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->appendSpoofedClient(Ljava/lang/String;)Ljava/lang/String;
+ move-result-object v$register
+ """
+ )
+ }
+ }
+
+ // endregion
+
/**
* Add settings
*/
diff --git a/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/fingerprints/NerdsStatsVideoFormatBuilderFingerprint.kt b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/fingerprints/NerdsStatsVideoFormatBuilderFingerprint.kt
new file mode 100644
index 000000000..7521265d3
--- /dev/null
+++ b/src/main/kotlin/app/revanced/patches/youtube/utils/fix/client/fingerprints/NerdsStatsVideoFormatBuilderFingerprint.kt
@@ -0,0 +1,12 @@
+package app.revanced.patches.youtube.utils.fix.client.fingerprints
+
+import app.revanced.patcher.extensions.or
+import app.revanced.patcher.fingerprint.MethodFingerprint
+import com.android.tools.smali.dexlib2.AccessFlags
+
+internal object NerdsStatsVideoFormatBuilderFingerprint : MethodFingerprint(
+ returnType = "Ljava/lang/String;",
+ accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
+ parameters = listOf("Lcom/google/android/libraries/youtube/innertube/model/media/FormatStreamModel;"),
+ strings = listOf("codecs=\""),
+)
diff --git a/src/main/resources/youtube/settings/host/values/arrays.xml b/src/main/resources/youtube/settings/host/values/arrays.xml
index 615d1498b..bf725ac44 100644
--- a/src/main/resources/youtube/settings/host/values/arrays.xml
+++ b/src/main/resources/youtube/settings/host/values/arrays.xml
@@ -115,7 +115,7 @@
- @string/revanced_spoof_client_options_entry_ios
- @string/revanced_spoof_client_options_entry_android_testsuite
- - @string/revanced_spoof_client_options_entry_android_tv
+ - @string/revanced_spoof_client_options_entry_android_unplugged
- @string/revanced_spoof_client_options_entry_android_vr
@@ -126,7 +126,7 @@
- @string/revanced_spoof_client_options_entry_ios
- - @string/revanced_spoof_client_options_entry_android_tv
+ - @string/revanced_spoof_client_options_entry_android_unplugged
- @string/revanced_spoof_client_options_entry_android_vr
diff --git a/src/main/resources/youtube/settings/host/values/strings.xml b/src/main/resources/youtube/settings/host/values/strings.xml
index bc7bb97a6..19082ab19 100644
--- a/src/main/resources/youtube/settings/host/values/strings.xml
+++ b/src/main/resources/youtube/settings/host/values/strings.xml
@@ -1459,17 +1459,24 @@ Limitation: Feed videos will play for less than 1 minute before encountering pla
Spoof client
Client is spoofed.
"Client is not spoofed. Video playback may not work."
+ Show in Stats for nerds
+ Spoofed client is shown in Stats for nerds.
+ Spoofed client is hidden in Stats for nerds.
Spoof client options
General
Live streams
Shorts, Clips
- Fallback
+ Unplayable video
iOS
+ Android
+ Android Embedded Player
Android Testsuite
- Android TV
+ Android TV
Android VR
+ TV HTML5
+ Web
About
diff --git a/src/main/resources/youtube/settings/xml/revanced_prefs.xml b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
index 77262961b..393494afa 100644
--- a/src/main/resources/youtube/settings/xml/revanced_prefs.xml
+++ b/src/main/resources/youtube/settings/xml/revanced_prefs.xml
@@ -540,6 +540,7 @@