This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove video from personalized feed
- Loading branch information
Showing
4 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
30 changes: 30 additions & 0 deletions
30
app/src/main/java/gm/tieba/tabswitch/hooker/eliminate/PurgeVideo.java
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,30 @@ | ||
package gm.tieba.tabswitch.hooker.eliminate; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import java.util.List; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
import gm.tieba.tabswitch.XposedContext; | ||
import gm.tieba.tabswitch.hooker.IHooker; | ||
|
||
public class PurgeVideo extends XposedContext implements IHooker { | ||
@NonNull | ||
@Override | ||
public String key() { | ||
return "purge_video"; | ||
} | ||
|
||
@Override | ||
public void hook() throws Throwable { | ||
XposedHelpers.findAndHookMethod("tbclient.Personalized.DataRes$Builder", sClassLoader, "build", boolean.class, new XC_MethodHook() { | ||
@Override | ||
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable { | ||
final List<?> threadList = (List<?>) XposedHelpers.getObjectField(param.thisObject, "thread_list"); | ||
if (threadList == null) return; | ||
threadList.removeIf(o -> XposedHelpers.getObjectField(o, "video_info") != null); | ||
} | ||
}); | ||
} | ||
} |