mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-18 23:37:18 +02:00
fix(YouTube/Spoof format stream data): some Uris are not hooked
This commit is contained in:
parent
707c9fd54d
commit
4a1fd29c01
@ -19,6 +19,7 @@ import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
|||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.getStringInstructionIndex
|
import app.revanced.util.getStringInstructionIndex
|
||||||
import app.revanced.util.getTargetIndex
|
import app.revanced.util.getTargetIndex
|
||||||
|
import app.revanced.util.getWalkerMethod
|
||||||
import app.revanced.util.indexOfFirstInstruction
|
import app.revanced.util.indexOfFirstInstruction
|
||||||
import app.revanced.util.patch.BaseBytecodePatch
|
import app.revanced.util.patch.BaseBytecodePatch
|
||||||
import app.revanced.util.resultOrThrow
|
import app.revanced.util.resultOrThrow
|
||||||
@ -61,6 +62,7 @@ object SpoofFormatStreamDataPatch : BaseBytecodePatch(
|
|||||||
"Lcom/google/protos/youtube/api/innertube/StreamingDataOuterClass\$StreamingData;"
|
"Lcom/google/protos/youtube/api/innertube/StreamingDataOuterClass\$StreamingData;"
|
||||||
|
|
||||||
private lateinit var hookMethod: MutableMethod
|
private lateinit var hookMethod: MutableMethod
|
||||||
|
private lateinit var uriMethod: MutableMethod
|
||||||
|
|
||||||
private fun MutableMethod.replaceFieldName(
|
private fun MutableMethod.replaceFieldName(
|
||||||
index: Int,
|
index: Int,
|
||||||
@ -90,7 +92,6 @@ object SpoofFormatStreamDataPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
FormatStreamModelConstructorFingerprint.resultOrThrow().let {
|
FormatStreamModelConstructorFingerprint.resultOrThrow().let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
|
|
||||||
// Find the field name that will be used for reflection.
|
// Find the field name that will be used for reflection.
|
||||||
val urlIndex = it.scanResult.patternScanResult!!.startIndex
|
val urlIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
val itagIndex = getTargetIndex(urlIndex + 1, Opcode.IGET)
|
val itagIndex = getTargetIndex(urlIndex + 1, Opcode.IGET)
|
||||||
@ -98,6 +99,17 @@ object SpoofFormatStreamDataPatch : BaseBytecodePatch(
|
|||||||
replaceFieldName(urlIndex, "replaceMeWithUrlFieldName")
|
replaceFieldName(urlIndex, "replaceMeWithUrlFieldName")
|
||||||
replaceFieldName(itagIndex, "replaceMeWithITagFieldName")
|
replaceFieldName(itagIndex, "replaceMeWithITagFieldName")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it.mutableClass.methods.find { method ->
|
||||||
|
method.parameters == listOf("Ljava/lang/String;")
|
||||||
|
&& method.returnType == "Landroid/net/Uri;"
|
||||||
|
}?.apply {
|
||||||
|
val walkerIndex = indexOfFirstInstruction {
|
||||||
|
opcode == Opcode.INVOKE_VIRTUAL
|
||||||
|
&& getReference<MethodReference>()?.returnType == "Landroid/net/Uri;"
|
||||||
|
}
|
||||||
|
uriMethod = getWalkerMethod(context, walkerIndex)
|
||||||
|
} ?: throw PatchException("Uri method not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
@ -166,6 +178,18 @@ object SpoofFormatStreamDataPatch : BaseBytecodePatch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uriMethod.apply {
|
||||||
|
val insertIndex = implementation!!.instructions.size - 1
|
||||||
|
val insertRegister = getInstruction<OneRegisterInstruction>(insertIndex).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
insertIndex, """
|
||||||
|
invoke-static { v$insertRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->hookUri(Landroid/net/Uri;)Landroid/net/Uri;
|
||||||
|
move-result-object v$insertRegister
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
// region hook endpoint url
|
// region hook endpoint url
|
||||||
|
Loading…
x
Reference in New Issue
Block a user