Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Commit

Permalink
允许显示up主弹幕
Browse files Browse the repository at this point in the history
  • Loading branch information
zerorooot committed Sep 15, 2022
1 parent c92d622 commit b690a3b
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 225 deletions.
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# FuckBilibiliVote
An xposed module for deleting Bilibili's video pop-ups for vote(投票) 、attention(一键三连)、link(预告)、up(up主弹幕) and grade(打分)
移除哔哩哔哩app中弹幕弹窗

Test video link https://www.bilibili.com/video/BV1Wy4y1m7Xu
相关测试视频:

log:

```json
{"vote":[{"time":"07:42 ~ 07:49","question":"谁来背这个锅?","option1":"使用AI的人","option2":"开发AI的人"}],"attention":{"time":"00:34 ~ 00:39"},"up":[{"content":"","time":"00:53"},{"content":"嗨呀,去年做好的视频啦,没想到,已经411年了","time":"05:16"}]}
https://www.bilibili.com/video/BV1Wy4y1m7Xu
```txt
vote : 07:42 ~ 07:49
attention : 00:34 ~ 00:39
up : 00:53、05:16
```

Test video link https://www.bilibili.com/video/BV1N5411Q7UU

log:

```json
{"operation_card_new":[{"time":"15 ~ 30","title":"凡人修仙传"}]}
https://www.bilibili.com/video/BV1N5411Q7UU
```txt
00:15 ~ 00:30
```
https://www.bilibili.com/video/BV1Lt4y137LY
```txt
00:17 ~ 00:23
```

注:如果你想显示up主弹幕,在`/sdcard/Android/`下新建一个名为`up`文件即可。

If you think this app is very helpful to you, please give me a free start, thanks
如果一切正常,你会在lsp日志里看到`fuckbilibilivote : 显示up主弹幕`

4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package="github.zerorooot.fuckbilibilivote">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:allowBackup="true"
android:fullBackupContent="true"
Expand All @@ -15,7 +17,7 @@
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="An xposed module for deleting Bilibili's video pop-ups for vote(投票) 、attention(一键三连)、link(预告)、up(up主弹幕) and grade(打分)" />
android:value="An xposed module for deleting Bilibili's video pop-ups" />
<meta-data
android:name="xposedminversion"
android:value="93" />
Expand Down

This file was deleted.

134 changes: 0 additions & 134 deletions app/src/main/java/github/zerorooot/fuckbilibilivote/MyLog.kt

This file was deleted.

89 changes: 56 additions & 33 deletions app/src/main/java/github/zerorooot/fuckbilibilivote/Xposed.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package github.zerorooot.fuckbilibilivote


import android.R.attr.classLoader
import android.os.Environment
import de.robv.android.xposed.IXposedHookLoadPackage
import de.robv.android.xposed.XC_MethodHook
import de.robv.android.xposed.XposedBridge
import de.robv.android.xposed.XposedHelpers
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam
import org.json.JSONObject
import java.io.File
import java.lang.reflect.Method


class Xposed : IXposedHookLoadPackage {
private val myLog by lazy { MyLog() }
private var printInfo = ""

@Throws(Throwable::class)
override fun handleLoadPackage(lpparam: LoadPackageParam) {
Expand All @@ -20,49 +21,71 @@ class Xposed : IXposedHookLoadPackage {
}


XposedHelpers.findAndHookMethod("com.bapis.bilibili.app.view.v1.ViewProgressReply",
XposedHelpers.findAndHookMethod(
"com.bapis.bilibili.app.view.v1.ViewProgressReply",
lpparam.classLoader, "getVideoGuide", object : XC_MethodHook() {
override fun afterHookedMethod(param: MethodHookParam) {
val result = param.result

val print = JSONObject()

if (result.toString().contains("operation_card_new")) {
print.put("operation_card_new", myLog.getOptionCardLog(result))

XposedHelpers.callMethod(result, "clearOperationCard")
XposedHelpers.callMethod(result, "clearOperationCardNew")
val config =
Environment.getExternalStorageDirectory().toString() + "/Android/up"
if (!File(config).exists()) {
XposedBridge.log("fuckbilibilivote : 清除所有弹窗")
XposedHelpers.callMethod(param.thisObject, "clearVideoGuide")
return
}

if (result.toString().contains("command_dms")) {
XposedHelpers.callMethod(param.thisObject, "clearVideoGuide")
print.put("command_dms", myLog.getDmsLog(result))
XposedBridge.log("fuckbilibilivote : 显示up主弹幕")
val result = param.result
val methodMap =
mapOf(
"getAttentionList" to "clearAttention",
"getCardsSecondList" to "clearCardsSecond",
"getOperationCardList" to "clearOperationCard",
"getOperationCardNewList" to "clearOperationCardNew"
)

methodMap.forEach { (t, u) ->
if ((XposedHelpers.callMethod(result, t) as List<*>).isNotEmpty()) {
XposedHelpers.callMethod(result, u)
}
}

if (print.length() != 0 && printInfo != print.toString()) {
XposedBridge.log(print.toString())
printInfo = print.toString()
val commandDmsList =
XposedHelpers.callMethod(result, "getCommandDmsList") as List<*>
if (commandDmsList.isNotEmpty()) {
commandDmsList.forEachIndexed { index, any ->
if (!XposedHelpers.callMethod(any, "getCommand").toString()
.contains("UP")
) {
XposedHelpers.callMethod(result, "removeCommandDms", index)
}
}
}


}
})
}
)

//番剧出现的广告,https://b23.tv/ep508404,21:52秒左右
//番剧出现的广告,https://b23.tv/ep508404,21:52秒左右
//com.bilibili.bangumi.remote.http.server.RemoteLogicService getOperationCardList
//6.85.0
XposedHelpers.findAndHookMethod("com.bilibili.bangumi.remote.http.impl.f",
lpparam.classLoader,
"q",
Long::class.javaPrimitiveType,
Int::class.javaPrimitiveType,
object : XC_MethodHook() {
@Throws(Throwable::class)
override fun afterHookedMethod(param: MethodHookParam) {
param.result = null
}
})

// XposedHelpers.findAndHookMethod("retrofit2.Retrofit",
// lpparam.classLoader,
// "loadServiceMethod",
// Method::class.java,
// object : XC_MethodHook() {
// @Throws(Throwable::class)
// override fun beforeHookedMethod(param: MethodHookParam) {
// val method = param.args[0] as Method
// XposedBridge.log("msj ${method.name}")
// if (method.name == "getOperationCardList") {
// param.result = null
// }
// }
// })
}

}



0 comments on commit b690a3b

Please sign in to comment.