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,
IntegrationsPatch::class,
PlayerTypeHookPatch::class,
VideoInformationPatch::class
VideoInformationPatch::class,
]
)
object SpoofSignaturePatch : BytecodePatch(
setOf(
ProtobufParameterBuilderFingerprint,
PlayerResponseModelImplFingerprint,
StoryboardThumbnailParentFingerprint,
StoryboardRendererSpecFingerprint,
PlayerResponseModelImplFingerprint
StoryboardRendererInitFingerprint
)
) {
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
@ -100,7 +101,7 @@ object SpoofSignaturePatch : BytecodePatch(
addInstructions(
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
"""
)
@ -115,13 +116,31 @@ object SpoofSignaturePatch : BytecodePatch(
0,
"""
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
""",
ExternalLabel("ignore", getInstruction(0))
)
}
} ?: 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"
+ "Side effects include:\\n"
+ "• No ambient mode\\n"
+ "• Videos cannot be downloaded\\n"
+ "• Low quality seekbar thumbnails (No thumbnails for age restricted or paid videos)"
+ "• Videos cannot be downloaded"
),
StringResource(
"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
)
)