fix(YouTube - ReturnYouTubeDislike): Fix RYD prefetching home feed Shorts (#3195)
This commit is contained in:
parent
d046e72369
commit
f3726fefb9
|
@ -58,7 +58,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
||||||
VideoIdPatch.hookVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
VideoIdPatch.hookVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
|
||||||
|
|
||||||
// Hook the player response video id, to start loading RYD sooner in the background.
|
// Hook the player response video id, to start loading RYD sooner in the background.
|
||||||
VideoIdPatch.hookPlayerResponseVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->preloadVideoId(Ljava/lang/String;)V")
|
VideoIdPatch.hookPlayerResponseVideoId("$INTEGRATIONS_CLASS_DESCRIPTOR->preloadVideoId(Ljava/lang/String;Z)V")
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ object ReturnYouTubeDislikePatch : BytecodePatch(
|
||||||
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
// Player response video id is needed to search for the video ids in Shorts litho components.
|
// Player response video id is needed to search for the video ids in Shorts litho components.
|
||||||
VideoIdPatch.hookPlayerResponseVideoId("$FILTER_CLASS_DESCRIPTOR->newPlayerResponseVideoId(Ljava/lang/String;)V")
|
VideoIdPatch.hookPlayerResponseVideoId("$FILTER_CLASS_DESCRIPTOR->newPlayerResponseVideoId(Ljava/lang/String;Z)V")
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ object VideoInformationPatch : BytecodePatch(
|
||||||
VideoIdPatch.hookVideoId(videoIdMethodDescriptor)
|
VideoIdPatch.hookVideoId(videoIdMethodDescriptor)
|
||||||
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
||||||
VideoIdPatch.hookPlayerResponseVideoId(
|
VideoIdPatch.hookPlayerResponseVideoId(
|
||||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;)V")
|
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the video time method
|
* Set the video time method
|
||||||
|
|
|
@ -19,6 +19,7 @@ object PlayerResponseMethodHookPatch :
|
||||||
Closeable,
|
Closeable,
|
||||||
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
||||||
private const val VIDEO_ID_PARAMETER = 1
|
private const val VIDEO_ID_PARAMETER = 1
|
||||||
|
private const val VIDEO_IS_OPENING_OR_PLAYING_PARAMETER = 11
|
||||||
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
||||||
|
|
||||||
private lateinit var playerResponseMethod: MutableMethod
|
private lateinit var playerResponseMethod: MutableMethod
|
||||||
|
@ -30,7 +31,7 @@ object PlayerResponseMethodHookPatch :
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
||||||
0, "invoke-static {p$VIDEO_ID_PARAMETER}, $hook"
|
0, "invoke-static {p$VIDEO_ID_PARAMETER, p$VIDEO_IS_OPENING_OR_PLAYING_PARAMETER}, $hook"
|
||||||
)
|
)
|
||||||
|
|
||||||
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
||||||
|
|
|
@ -18,7 +18,7 @@ object PlayerParameterBuilderFingerprint : MethodFingerprint(
|
||||||
"Ljava/lang/String;",
|
"Ljava/lang/String;",
|
||||||
"Ljava/lang/String;",
|
"Ljava/lang/String;",
|
||||||
"L",
|
"L",
|
||||||
"Z",
|
"Z", // Appears to indicate if the video id is being opened or is currently playing.
|
||||||
"Z",
|
"Z",
|
||||||
"Z"
|
"Z"
|
||||||
)
|
)
|
||||||
|
|
|
@ -103,6 +103,9 @@ object VideoIdPatch : BytecodePatch(
|
||||||
* Hooks the video id of every video when loaded.
|
* Hooks the video id of every video when loaded.
|
||||||
* Supports all videos and functions in all situations.
|
* Supports all videos and functions in all situations.
|
||||||
*
|
*
|
||||||
|
* First parameter is the video id.
|
||||||
|
* Second parameter is if the video is being opened or is currently playing.
|
||||||
|
*
|
||||||
* Hook is always called off the main thread.
|
* Hook is always called off the main thread.
|
||||||
*
|
*
|
||||||
* This hook is called as soon as the player response is parsed,
|
* This hook is called as soon as the player response is parsed,
|
||||||
|
@ -117,7 +120,7 @@ object VideoIdPatch : BytecodePatch(
|
||||||
*
|
*
|
||||||
* Be aware, this can be called multiple times for the same video id.
|
* Be aware, this can be called multiple times for the same video id.
|
||||||
*
|
*
|
||||||
* @param methodDescriptor which method to call. Params have to be `Ljava/lang/String;`
|
* @param methodDescriptor which method to call. Params must be `Ljava/lang/String;Z`
|
||||||
*/
|
*/
|
||||||
fun hookPlayerResponseVideoId(methodDescriptor: String) {
|
fun hookPlayerResponseVideoId(methodDescriptor: String) {
|
||||||
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.VideoId(
|
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.VideoId(
|
||||||
|
|
Loading…
Reference in a new issue