-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube - Spoof client): Partial fix for watch history issue of b…
…rand accounts on iOS clients
- Loading branch information
1 parent
0ef9a65
commit 2294ffb
Showing
7 changed files
with
130 additions
and
29 deletions.
There are no files selected for viewing
26 changes: 6 additions & 20 deletions
26
src/main/kotlin/app/revanced/patches/youtube/misc/watchhistory/WatchHistoryPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
...app/revanced/patches/youtube/utils/fingerprints/OrganicPlaybackContextModelFingerprint.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
.../patches/youtube/utils/fix/client/fingerprints/BuildPlaybackStatsRequestURIFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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 | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal object BuildPlaybackStatsRequestURIFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC, | ||
returnType = "L", | ||
opcodes = listOf( | ||
Opcode.INVOKE_STATIC, | ||
Opcode.MOVE_RESULT_OBJECT, | ||
Opcode.CONST_STRING, | ||
), | ||
strings = listOf("event", "streamingstats"), | ||
) |
24 changes: 24 additions & 0 deletions
24
...d/patches/youtube/utils/fix/client/fingerprints/OrganicPlaybackContextModelFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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 | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal object OrganicPlaybackContextModelFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, | ||
parameters = listOf( | ||
"Ljava/lang/String;", // cpn | ||
"Z", | ||
"Z", | ||
"Z", | ||
"Z" | ||
), | ||
opcodes = listOf( | ||
Opcode.INVOKE_DIRECT, | ||
Opcode.IF_EQZ, | ||
Opcode.IPUT_OBJECT, | ||
), | ||
strings = listOf("Null contentCpn") | ||
) |
42 changes: 42 additions & 0 deletions
42
src/main/kotlin/app/revanced/patches/youtube/utils/trackingurlhook/TrackingUrlHookPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package app.revanced.patches.youtube.utils.trackingurlhook | ||
|
||
import app.revanced.patcher.data.BytecodeContext | ||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions | ||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction | ||
import app.revanced.patcher.patch.BytecodePatch | ||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod | ||
import app.revanced.patches.youtube.utils.trackingurlhook.fingerprints.TrackingUrlModelFingerprint | ||
import app.revanced.util.getTargetIndexWithMethodReferenceNameOrThrow | ||
import app.revanced.util.resultOrThrow | ||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction | ||
|
||
object TrackingUrlHookPatch : BytecodePatch( | ||
setOf(TrackingUrlModelFingerprint) | ||
) { | ||
private lateinit var trackingUrlMethod: MutableMethod | ||
|
||
override fun execute(context: BytecodeContext) { | ||
trackingUrlMethod = TrackingUrlModelFingerprint.resultOrThrow().mutableMethod | ||
} | ||
|
||
internal fun hookTrackingUrl( | ||
descriptor: String | ||
) = trackingUrlMethod.apply { | ||
val targetIndex = getTargetIndexWithMethodReferenceNameOrThrow("parse") + 1 | ||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA | ||
|
||
var smaliInstruction = "invoke-static {v$targetRegister}, $descriptor" | ||
|
||
if (!descriptor.endsWith("V")) { | ||
smaliInstruction += """ | ||
move-result-object v$targetRegister | ||
""".trimIndent() | ||
} | ||
|
||
addInstructions( | ||
targetIndex + 1, | ||
smaliInstruction | ||
) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ngerprints/TrackingUrlModelFingerprint.kt → ...ngerprints/TrackingUrlModelFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters