mirror of
https://github.com/revanced/revanced-patches
synced 2024-11-10 16:19:23 +01:00
feat: tiktok-download
and tiktok-seekbar
patch (#405)
This commit is contained in:
parent
b8664d84f7
commit
46949f0907
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.downloads.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[
|
||||||
|
Package("com.ss.android.ugc.trill", arrayOf()),
|
||||||
|
Package("com.zhiliaoapp.musically", arrayOf())
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class DownloadsCompatibility
|
@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.downloads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("acl-common-share-get-code")
|
||||||
|
@MatchingMethod("ACLCommonShare", "getCode")
|
||||||
|
@DownloadsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ACLCommonShareFingerprint : MethodFingerprint(
|
||||||
|
"I",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("/ACLCommonShare;") &&
|
||||||
|
methodDef.name == "getCode"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.downloads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("acl-common-share-get-show-type")
|
||||||
|
@MatchingMethod("ACLCommonShare", "getShowType")
|
||||||
|
@DownloadsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ACLCommonShareFingerprint2 : MethodFingerprint(
|
||||||
|
"I",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("/ACLCommonShare;") &&
|
||||||
|
methodDef.name == "getShowType"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,25 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.downloads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("acl-common-share-get-transcode")
|
||||||
|
@MatchingMethod("ACLCommonShare", "getTranscode")
|
||||||
|
@DownloadsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ACLCommonShareFingerprint3 : MethodFingerprint(
|
||||||
|
"I",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("/ACLCommonShare;") &&
|
||||||
|
methodDef.name == "getTranscode"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,56 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.downloads.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.tiktok.interaction.downloads.annotations.DownloadsCompatibility
|
||||||
|
import app.revanced.patches.tiktok.interaction.downloads.fingerprints.*
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("tiktok-download")
|
||||||
|
@Description("Remove restrictions on downloads video.")
|
||||||
|
@DownloadsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DownloadsPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
ACLCommonShareFingerprint,
|
||||||
|
ACLCommonShareFingerprint2,
|
||||||
|
ACLCommonShareFingerprint3
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
val method1 = ACLCommonShareFingerprint.result!!.mutableMethod
|
||||||
|
method1.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x0
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
val method2 = ACLCommonShareFingerprint2.result!!.mutableMethod
|
||||||
|
method2.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x2
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
//Download videos without watermark.
|
||||||
|
val method3 = ACLCommonShareFingerprint3.result!!.mutableMethod
|
||||||
|
method3.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.seekbar.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[
|
||||||
|
Package("com.ss.android.ugc.trill", arrayOf()),
|
||||||
|
Package("com.zhiliaoapp.musically", arrayOf())
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class SeekbarCompatibility
|
@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.seekbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
@Name("aweme-get-video-control")
|
||||||
|
@MatchingMethod("Aweme", "getVideoControl")
|
||||||
|
@SeekbarCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object AwemeGetVideoControlFingerprint : MethodFingerprint(
|
||||||
|
"L",
|
||||||
|
AccessFlags.PUBLIC.value,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.definingClass.endsWith("/Aweme;") && methodDef.name == "getVideoControl"
|
||||||
|
}
|
||||||
|
)
|
@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.tiktok.interaction.seekbar.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.tiktok.interaction.seekbar.annotations.SeekbarCompatibility
|
||||||
|
import app.revanced.patches.tiktok.interaction.seekbar.fingerprints.*
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction11n
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("tiktok-seekbar")
|
||||||
|
@Description("Show progress bar for all video.")
|
||||||
|
@SeekbarCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class TiktokSeekbarPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
AwemeGetVideoControlFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
//Get VideoControl FieldReference
|
||||||
|
val videoControl = data.findClass { it.type.endsWith("/VideoControl;") }
|
||||||
|
?: return PatchResultError("Can not find target class")
|
||||||
|
val fieldList = videoControl.immutableClass.fields.associateBy { field -> field.name }
|
||||||
|
|
||||||
|
val method = AwemeGetVideoControlFingerprint.result!!.mutableMethod
|
||||||
|
val implementation = method.implementation!!
|
||||||
|
implementation.addInstructions(
|
||||||
|
1, listOf(
|
||||||
|
BuilderInstruction11n(Opcode.CONST_4, 1, 1),
|
||||||
|
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["showProgressBar"]!!),
|
||||||
|
BuilderInstruction22c(Opcode.IPUT, 1, 0, fieldList["draftProgressBar"]!!)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user