fix(YouTube - Client spoof): Display seekbar thumbnails in high quality

This commit is contained in:
oSumAtrIX 2023-09-25 23:50:42 +02:00
parent 7f1a1fc9fa
commit 5e8a2d3fe7
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
3 changed files with 39 additions and 6 deletions

View file

@ -23,15 +23,16 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
SpoofSignatureResourcePatch::class, SpoofSignatureResourcePatch::class,
IntegrationsPatch::class, IntegrationsPatch::class,
PlayerTypeHookPatch::class, PlayerTypeHookPatch::class,
VideoInformationPatch::class VideoInformationPatch::class,
] ]
) )
object SpoofSignaturePatch : BytecodePatch( object SpoofSignaturePatch : BytecodePatch(
setOf( setOf(
ProtobufParameterBuilderFingerprint, ProtobufParameterBuilderFingerprint,
PlayerResponseModelImplFingerprint,
StoryboardThumbnailParentFingerprint, StoryboardThumbnailParentFingerprint,
StoryboardRendererSpecFingerprint, StoryboardRendererSpecFingerprint,
PlayerResponseModelImplFingerprint StoryboardRendererInitFingerprint
) )
) { ) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR = private const val INTEGRATIONS_CLASS_DESCRIPTOR =
@ -100,7 +101,7 @@ object SpoofSignaturePatch : BytecodePatch(
addInstructions( addInstructions(
getStoryBoardIndex, getStoryBoardIndex,
""" """
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec()Ljava/lang/String; invoke-static { v$getStoryBoardRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec(Ljava/lang/String;)Ljava/lang/String;
move-result-object v$getStoryBoardRegister move-result-object v$getStoryBoardRegister
""" """
) )
@ -115,13 +116,31 @@ object SpoofSignaturePatch : BytecodePatch(
0, 0,
""" """
if-nez p$storyBoardUrlParams, :ignore if-nez p$storyBoardUrlParams, :ignore
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec()Ljava/lang/String; invoke-static { p$storyBoardUrlParams }, $INTEGRATIONS_CLASS_DESCRIPTOR->getStoryboardRendererSpec(Ljava/lang/String;)Ljava/lang/String;
move-result-object p$storyBoardUrlParams move-result-object p$storyBoardUrlParams
""", """,
ExternalLabel("ignore", getInstruction(0)) ExternalLabel("ignore", getInstruction(0))
) )
} }
} ?: throw StoryboardRendererSpecFingerprint.exception } ?: throw StoryboardRendererSpecFingerprint.exception
// Hook recommended value
StoryboardRendererInitFingerprint.result?.let {
val moveOriginalRecommendedValueIndex = it.scanResult.patternScanResult!!.endIndex
val originalValueRegister = it.mutableMethod
.getInstruction<OneRegisterInstruction>(moveOriginalRecommendedValueIndex).registerA
it.mutableMethod.apply {
addInstructions(
moveOriginalRecommendedValueIndex + 1,
"""
invoke-static { v$originalValueRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getRecommendedLevel(I)I
move-result v$originalValueRegister
"""
)
}
} ?: throw StoryboardRendererInitFingerprint.exception
} }
} }
} }

View file

@ -30,8 +30,7 @@ object SpoofSignatureResourcePatch : ResourcePatch() {
"App signature spoofed\\n\\n" "App signature spoofed\\n\\n"
+ "Side effects include:\\n" + "Side effects include:\\n"
+ "• No ambient mode\\n" + "• No ambient mode\\n"
+ "• Videos cannot be downloaded\\n" + "• Videos cannot be downloaded"
+ "• Low quality seekbar thumbnails (No thumbnails for age restricted or paid videos)"
), ),
StringResource( StringResource(
"revanced_spoof_signature_verification_enabled_summary_off", "revanced_spoof_signature_verification_enabled_summary_off",

View file

@ -0,0 +1,15 @@
package app.revanced.patches.youtube.misc.fix.playback.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import com.android.tools.smali.dexlib2.Opcode
object StoryboardRendererInitFingerprint : MethodFingerprint(
strings = listOf("#-1#"),
opcodes = listOf(
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT
)
)