fix(youtube/return-youtube-dislike): do not fetch voting stats when watching shorts (#1532)
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
0d14c46a1b
commit
f46fcadd85
|
@ -19,17 +19,28 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.Retu
|
||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints.*
|
||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@DependsOn([IntegrationsPatch::class, VideoIdPatch::class, ReturnYouTubeDislikeResourcePatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
IntegrationsPatch::class,
|
||||||
|
VideoIdPatch::class,
|
||||||
|
ReturnYouTubeDislikeResourcePatch::class,
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
|
]
|
||||||
|
)
|
||||||
@Name("return-youtube-dislike")
|
@Name("return-youtube-dislike")
|
||||||
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
@Description("Shows the dislike count of videos using the Return YouTube Dislike API.")
|
||||||
@ReturnYouTubeDislikeCompatibility
|
@ReturnYouTubeDislikeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class ReturnYouTubeDislikePatch : BytecodePatch(
|
class ReturnYouTubeDislikePatch : BytecodePatch(
|
||||||
listOf(
|
listOf(
|
||||||
TextComponentSpecParentFingerprint, LikeFingerprint, DislikeFingerprint, RemoveLikeFingerprint
|
TextComponentSpecParentFingerprint,
|
||||||
|
LikeFingerprint,
|
||||||
|
DislikeFingerprint,
|
||||||
|
RemoveLikeFingerprint,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
|
||||||
import org.jf.dexlib2.AccessFlags
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(3)
|
|
||||||
object ShortsPlayerConstructorFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.MOVE_OBJECT_FROM16,
|
|
||||||
Opcode.INVOKE_DIRECT_RANGE,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.CONST_4
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef ->
|
|
||||||
methodDef.implementation?.instructions?.any { instruction ->
|
|
||||||
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
|
|
||||||
(instruction as? WideLiteralInstruction)?.wideLiteral == SponsorBlockResourcePatch.reelButtonGroupResourceId
|
|
||||||
} == true
|
|
||||||
}
|
|
||||||
)
|
|
|
@ -23,6 +23,7 @@ import app.revanced.patches.youtube.layout.sponsorblock.bytecode.fingerprints.*
|
||||||
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
import app.revanced.patches.youtube.layout.sponsorblock.resource.patch.SponsorBlockResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
import app.revanced.patches.youtube.misc.playercontrols.bytecode.patch.PlayerControlsBytecodePatch
|
||||||
|
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
|
||||||
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
import app.revanced.patches.youtube.misc.video.information.patch.VideoInformationPatch
|
||||||
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
import app.revanced.patches.youtube.misc.video.videoid.patch.VideoIdPatch
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
|
@ -35,6 +36,7 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
||||||
dependencies = [
|
dependencies = [
|
||||||
VideoInformationPatch::class, // updates video information and adds method to seek in video
|
VideoInformationPatch::class, // updates video information and adds method to seek in video
|
||||||
PlayerControlsBytecodePatch::class,
|
PlayerControlsBytecodePatch::class,
|
||||||
|
PlayerTypeHookPatch::class,
|
||||||
IntegrationsPatch::class,
|
IntegrationsPatch::class,
|
||||||
SponsorBlockResourcePatch::class,
|
SponsorBlockResourcePatch::class,
|
||||||
VideoIdPatch::class
|
VideoIdPatch::class
|
||||||
|
@ -50,7 +52,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||||
NextGenWatchLayoutFingerprint,
|
NextGenWatchLayoutFingerprint,
|
||||||
AppendTimeFingerprint,
|
AppendTimeFingerprint,
|
||||||
PlayerOverlaysLayoutInitFingerprint,
|
PlayerOverlaysLayoutInitFingerprint,
|
||||||
ShortsPlayerConstructorFingerprint,
|
|
||||||
StartVideoInformerFingerprint
|
StartVideoInformerFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -232,23 +233,6 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||||
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
|
"invoke-static {p0}, Lapp/revanced/integrations/sponsorblock/player/ui/SponsorBlockView;->initialize(Ljava/lang/Object;)V"
|
||||||
)
|
)
|
||||||
|
|
||||||
val startVideoInformerMethod = StartVideoInformerFingerprint.result!!.mutableMethod
|
|
||||||
startVideoInformerMethod.addInstructions(
|
|
||||||
0, """
|
|
||||||
const/4 v0, 0x0
|
|
||||||
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
val shortsPlayerConstructorMethod = ShortsPlayerConstructorFingerprint.result!!.mutableMethod
|
|
||||||
|
|
||||||
shortsPlayerConstructorMethod.addInstructions(
|
|
||||||
0, """
|
|
||||||
const/4 v0, 0x1
|
|
||||||
sput-boolean v0, $INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->shorts_playing:Z
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO: isSBChannelWhitelisting implementation
|
// TODO: isSBChannelWhitelisting implementation
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
|
|
|
@ -23,9 +23,6 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
|
||||||
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
|
@DependsOn([FixLocaleConfigErrorPatch::class, SettingsPatch::class, ResourceMappingPatch::class])
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SponsorBlockResourcePatch : ResourcePatch {
|
class SponsorBlockResourcePatch : ResourcePatch {
|
||||||
companion object {
|
|
||||||
internal var reelButtonGroupResourceId: Long = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun execute(context: ResourceContext): PatchResult {
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
val youtubePackage = "com.google.android.youtube"
|
val youtubePackage = "com.google.android.youtube"
|
||||||
|
@ -107,10 +104,6 @@ class SponsorBlockResourcePatch : ResourcePatch {
|
||||||
}
|
}
|
||||||
}.close() // close afterwards
|
}.close() // close afterwards
|
||||||
|
|
||||||
reelButtonGroupResourceId = ResourceMappingPatch.resourceMappings.single {
|
|
||||||
it.type == "id" && it.name == "reel_persistent_edu_button_group"
|
|
||||||
}.id
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue