();
25 | }
26 |
27 | public boolean add(Raffle raffle) {
28 | boolean isOk = raffle != null && raffles.add(raffle);
29 | if(raffles.size() >= LIMIT) {
30 | raffles.clear();
31 | }
32 | return isOk;
33 | }
34 |
35 | public void clear() {
36 | raffles.clear();
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/bean/ldm/TaskStatus.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.bean.ldm;
2 |
3 | /**
4 | *
5 | * 日常任务执行状态
6 | *
7 | *
PROJECT : bilibili-plugin
8 | *
SUPPORT : www.exp-blog.com
9 | * @version 2018-03-15
10 | * @author EXP: 272629724@qq.com
11 | * @since jdk版本:jdk1.6
12 | */
13 | public class TaskStatus {
14 |
15 | private final static int _INIT = 0;
16 |
17 | private final static int SIGN = 1;
18 |
19 | private final static int ASSN = 2;
20 |
21 | private final static int MATH = 4;
22 |
23 | private final static int DAILT_GIFT = 8;
24 |
25 | private final static int HOLIDAY_GIFT = 16;
26 |
27 | private final static int FEED = 32; // 投喂礼物不作为日常任务是否完成的判断依据之一
28 |
29 | private final static int _FIN = SIGN | ASSN | MATH | DAILT_GIFT | HOLIDAY_GIFT;
30 |
31 | private int status;
32 |
33 | public TaskStatus() {
34 | init();
35 | }
36 |
37 | public void init() {
38 | this.status = _INIT;
39 | }
40 |
41 | public boolean isAllFinish() {
42 | return status == _FIN;
43 | }
44 |
45 | public boolean isFinSign() { return (status & SIGN) != _INIT; }
46 | public boolean isFinAssn() { return (status & ASSN) != _INIT; }
47 | public boolean isFinMath() { return (status & MATH) != _INIT; }
48 | public boolean isFinDailyGift() { return (status & DAILT_GIFT) != _INIT; }
49 | public boolean isFinHoliday() { return (status & HOLIDAY_GIFT) != _INIT; }
50 | public boolean isFinFeed() { return (status & FEED) != _INIT; }
51 |
52 | public void markSign() { status |= SIGN; }
53 | public void markAssn() { status |= ASSN; }
54 | public void markMath() { status |= MATH; }
55 | public void markDailyGift() { status |= DAILT_GIFT; }
56 | public void markHolidayGift() { status |= HOLIDAY_GIFT; }
57 | public void markFeed() { status |= FEED; }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/Area.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | /**
4 | *
5 | * B站分区
6 | *
7 | *
PROJECT : bilibili-plugin
8 | *
SUPPORT : www.exp-blog.com
9 | * @version 2018-06-22
10 | * @author EXP: 272629724@qq.com
11 | * @since jdk版本:jdk1.6
12 | */
13 | public class Area {
14 |
15 | public final static Area AMUSE = new Area("1", "娱乐区");
16 |
17 | public final static Area PC_GAME = new Area("2", "游戏区");
18 |
19 | public final static Area APP_GAME = new Area("3", "手游区");
20 |
21 | public final static Area DRAW = new Area("4", "绘画区");
22 |
23 | public final static Area RADIO = new Area("5", "电台区");
24 |
25 | private String id;
26 |
27 | private String desc;
28 |
29 | private Area(String id, String desc) {
30 | this.id = id;
31 | this.desc = desc;
32 | }
33 |
34 | public String ID() {
35 | return id;
36 | }
37 |
38 | public String DESC() {
39 | return desc;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | return DESC();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/CookieType.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | /**
4 | *
5 | * cookie类型
6 | *
7 | *
PROJECT : bilibili-plugin
8 | *
SUPPORT : www.exp-blog.com
9 | * @version 2018-01-31
10 | * @author EXP: 272629724@qq.com
11 | * @since jdk版本:jdk1.6
12 | */
13 | public class CookieType {
14 |
15 | public final static CookieType MAIN = new CookieType(1, "主号");
16 |
17 | public final static CookieType MINI = new CookieType(2, "小号");
18 |
19 | public final static CookieType VEST = new CookieType(3, "马甲号");
20 |
21 | public final static CookieType UNKNOW = new CookieType(4, "未知号");
22 |
23 | private int id;
24 |
25 | private String desc;
26 |
27 | private CookieType(int id, String desc) {
28 | this.id = id;
29 | this.desc = desc;
30 | }
31 |
32 | public int ID() {
33 | return id;
34 | }
35 |
36 | public String DESC() {
37 | return desc;
38 | }
39 |
40 | @Override
41 | public String toString() {
42 | return DESC();
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/Danmu.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | /**
4 | *
5 | * 弹幕参数
6 | *
7 | *
PROJECT : bilibili-plugin
8 | *
SUPPORT : www.exp-blog.com
9 | * @version 2017-12-17
10 | * @author EXP: 272629724@qq.com
11 | * @since jdk版本:jdk1.6
12 | */
13 | public class Danmu {
14 |
15 | /** 普通用户默认弹幕长度上限: 20 */
16 | public final static int LEN = 20;
17 |
18 | /** 月费老爷/年费老爷弹幕长度上限: 30 */
19 | public final static int LEN_VIP = 30;
20 |
21 | /** 提督/总督在特定直播间的弹幕长度上限: 40 */
22 | public final static int LEN_GUARD = 40;
23 |
24 | /** 当前B站最长的弹幕长度上限: 40 */
25 | public final static int LEN_LIMIT = 40;
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/GuardType.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | import exp.libs.utils.other.ObjUtils;
4 |
5 | /**
6 | *
7 | * 船员类型
8 | *
9 | *
PROJECT : bilibili-plugin
10 | *
SUPPORT : www.exp-blog.com
11 | * @version 2018-01-31
12 | * @author EXP: 272629724@qq.com
13 | * @since jdk版本:jdk1.6
14 | */
15 | public class GuardType {
16 |
17 | public final static GuardType CIVILIAN = new GuardType(0, "平民");
18 |
19 | public final static GuardType VICEROY = new GuardType(1, "总督");
20 |
21 | public final static GuardType GOVERNOR = new GuardType(2, "提督");
22 |
23 | public final static GuardType CAPTAIN = new GuardType(3, "舰长");
24 |
25 | private int id;
26 |
27 | private String desc;
28 |
29 | private GuardType(int id, String desc) {
30 | this.id = id;
31 | this.desc = desc;
32 | }
33 |
34 | public int ID() {
35 | return id;
36 | }
37 |
38 | public String DESC() {
39 | return desc;
40 | }
41 |
42 | public static GuardType toGuardType(int id) {
43 | GuardType type = CIVILIAN;
44 | if(id == CAPTAIN.ID()) {
45 | type = CAPTAIN;
46 |
47 | } else if(id == GOVERNOR.ID()) {
48 | type = GOVERNOR;
49 |
50 | } else if(id == VICEROY.ID()) {
51 | type = VICEROY;
52 | }
53 | return type;
54 | }
55 |
56 | public static GuardType toGuardType(String desc) {
57 | GuardType type = CIVILIAN;
58 | if(CAPTAIN.DESC().equals(desc)) {
59 | type = CAPTAIN;
60 |
61 | } else if(GOVERNOR.DESC().equals(desc)) {
62 | type = GOVERNOR;
63 |
64 | } else if(VICEROY.DESC().equals(desc)) {
65 | type = VICEROY;
66 | }
67 | return type;
68 | }
69 |
70 | @Override
71 | public String toString() {
72 | return ObjUtils.toBeanInfo(this);
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/Identity.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | import exp.libs.utils.encode.CryptoUtils;
4 |
5 | /**
6 | *
7 | * 登陆用户的身份授权等级
8 | *
9 | *
PROJECT : bilibili-plugin
10 | *
SUPPORT : www.exp-blog.com
11 | * @version 2017-12-17
12 | * @author EXP: 272629724@qq.com
13 | * @since jdk版本:jdk1.6
14 | */
15 | public class Identity {
16 |
17 | /** 试用用户: -guest */
18 | public final static Identity GUEST = new Identity(0, CryptoUtils.deDES("10F55724557C0D55"));
19 |
20 | /** 普通用户: -user */
21 | public final static Identity USER = new Identity(1, CryptoUtils.deDES("637B5DE0EB673958"));
22 |
23 | /** 主播用户: -uplive */
24 | public final static Identity UPLIVE = new Identity(2, CryptoUtils.deDES("46E8E743224934BA"));
25 |
26 | /** 管理员: -admin */
27 | public final static Identity ADMIN = new Identity(3, CryptoUtils.deDES("2FE643641A75D30D"));
28 |
29 | /** 当前登陆用户的身份 */
30 | private static Identity identity = USER;
31 |
32 | /** 授权等级 */
33 | private int level;
34 |
35 | /** 鉴别命令 */
36 | private String cmd;
37 |
38 | /**
39 | * 构造函数
40 | * @param level 授权等级
41 | * @param cmd 鉴别命令
42 | */
43 | private Identity(int level, String cmd) {
44 | this.level = level;
45 | this.cmd = cmd;
46 | }
47 |
48 | public int LV() {
49 | return level;
50 | }
51 |
52 | public String CMD() {
53 | return cmd;
54 | }
55 |
56 | public static Identity CURRENT() {
57 | return identity;
58 | }
59 |
60 | public static void set(Identity identity) {
61 | Identity.identity = (identity == null ? USER : identity);
62 | }
63 |
64 | public static boolean less(Identity identity) {
65 | boolean isLess = true;
66 | if(identity != null) {
67 | isLess = (CURRENT().LV() < identity.LV());
68 | }
69 | return isLess;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/envm/LotteryType.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.envm;
2 |
3 | /**
4 | *
5 | * 抽奖类型
6 | *
7 | *
PROJECT : bilibili-plugin
8 | *
SUPPORT : www.exp-blog.com
9 | * @version 2017-12-17
10 | * @author EXP: 272629724@qq.com
11 | * @since jdk版本:jdk1.6
12 | */
13 | public class LotteryType {
14 |
15 | /** 高能礼物抽奖 */
16 | private final static short TYPE_EG = 0;
17 | public final static LotteryType ENGERY = new LotteryType(TYPE_EG);
18 |
19 | /** 小电视抽奖 */
20 | private final static short TYPE_TV = 1;
21 | public final static LotteryType TV = new LotteryType(TYPE_TV);
22 |
23 | /** 节奏风暴抽奖 */
24 | private final static short TYPE_STORM = 2;
25 | public final static LotteryType STORM = new LotteryType(TYPE_STORM);
26 |
27 | /** 总督领奖 */
28 | private final static short TYPE_GUARD = 3;
29 | public final static LotteryType GUARD = new LotteryType(TYPE_GUARD);
30 |
31 | private short type;
32 |
33 | private LotteryType(short type) {
34 | this.type = type;
35 | }
36 |
37 | public short TYPE() {
38 | return type;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/monitor/_ExitNoticeUI.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.monitor;
2 |
3 | import java.awt.BorderLayout;
4 |
5 | import javax.swing.JEditorPane;
6 | import javax.swing.JPanel;
7 |
8 | import exp.bilibili.plugin.utils.SwingUtils;
9 | import exp.libs.utils.other.StrUtils;
10 | import exp.libs.warp.ui.cpt.win.NoticeWindow;
11 |
12 | /**
13 | *
14 | * 授权无效导致程序自动退出的通知面板
15 | *
16 | *
PROJECT : bilibili-plugin
17 | *
SUPPORT : www.exp-blog.com
18 | * @version 2018-01-11
19 | * @author EXP: 272629724@qq.com
20 | * @since jdk版本:jdk1.6
21 | */
22 | public class _ExitNoticeUI extends NoticeWindow {
23 |
24 | /** serialVersionUID */
25 | private static final long serialVersionUID = -7835582158711626274L;
26 |
27 | private final static int WIDTH = 300;
28 |
29 | private final static int HEIGHT = 150;
30 |
31 | private JEditorPane editor;
32 |
33 | public _ExitNoticeUI(String cause) {
34 | super("授权校验失败", WIDTH, HEIGHT, false, cause);
35 | }
36 |
37 | @Override
38 | protected void initComponents(Object... args) {
39 | this.editor = new JEditorPane();
40 | editor.setEditable(false);
41 | editor.setContentType("text/html"); // 将编辑框设置为支持html的编辑格式
42 |
43 | if(args != null && args.length > 0) {
44 | String cause = (String) args[0];
45 | editor.setText(getNoticeText(cause));
46 | }
47 | }
48 |
49 | @Override
50 | protected int LOCATION() {
51 | return LOCATION_CENTER; // 出现坐标屏幕中心
52 | }
53 |
54 | @Override
55 | protected void setComponentsLayout(JPanel rootPanel) {
56 | rootPanel.add(SwingUtils.addBorder(editor), BorderLayout.CENTER);
57 | }
58 |
59 | @Override
60 | protected void setComponentsListener(JPanel rootPanel) {
61 | // Undo
62 | }
63 |
64 | private String getNoticeText(String cause) {
65 | String text = StrUtils.concat(
66 | "",
67 | "",
68 | "",
69 | "哔哩哔哩插件姬 即将停止
",
70 | "[", cause, "]",
71 | "
",
72 | "",
73 | ""
74 | );
75 | return text;
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/App.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | import exp.bilibili.plugin.Config;
7 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
8 | import exp.bilibili.plugin.cache.CookiesMgr;
9 | import exp.bilibili.plugin.cache.WebBot;
10 | import exp.bilibili.plugin.envm.CookieType;
11 | import exp.bilibili.plugin.envm.Identity;
12 | import exp.bilibili.protocol.XHRSender;
13 | import exp.bilibili.protocol.ws.BiliWebSocketMgr;
14 |
15 | /**
16 | *
17 | * 主应用程序(无窗口)
18 | *
19 | *
PROJECT : bilibili-plugin
20 | *
SUPPORT : www.exp-blog.com
21 | * @version 2019-08-04
22 | * @author EXP: 272629724@qq.com
23 | * @since jdk版本:jdk1.6
24 | */
25 | public class App {
26 |
27 | private final static Logger log = LoggerFactory.getLogger(App.class);
28 |
29 | /**
30 | * 创建实例
31 | * @param args main入参
32 | */
33 | public static void createInstn(String[] args) {
34 |
35 | // 登陆所有账号
36 | loadAllCookies();
37 |
38 |
39 | // 授权并连接到版聊直播间
40 | Identity.set(Identity.ADMIN);
41 | final BiliWebSocketMgr wsMgr = new BiliWebSocketMgr();
42 | wsMgr.relinkLive(Config.getInstn().SIGN_ROOM_ID());
43 | wsMgr._start(); // 启动分区监听
44 |
45 |
46 | // 启动仿真机器人
47 | WebBot.getInstn()._start();
48 |
49 |
50 | // 释放资源
51 | Runtime.getRuntime().addShutdownHook(new Thread() {
52 |
53 | @Override
54 | public void run() {
55 | WebBot.getInstn()._stop();
56 | wsMgr._stop();
57 | }
58 | });
59 | }
60 |
61 | /**
62 | * 加载所有账号的 cookies
63 | */
64 | private static void loadAllCookies() {
65 | if(CookiesMgr.getInstn().load(CookieType.MAIN)) {
66 | log.info("已登陆主号: {}", CookiesMgr.MAIN().NICKNAME());
67 | XHRSender.queryUserAuthorityInfo(CookiesMgr.MAIN());
68 | }
69 |
70 | if(CookiesMgr.getInstn().load(CookieType.MINI)) {
71 | for(BiliCookie mini : CookiesMgr.MINIs()) {
72 | log.info("已登陆小号: {}", mini.NICKNAME());
73 | XHRSender.queryUserAuthorityInfo(mini);
74 | }
75 | }
76 |
77 | if(CookiesMgr.getInstn().load(CookieType.VEST)) {
78 | log.info("已登陆马甲号: {}", CookiesMgr.VEST().NICKNAME());
79 | XHRSender.queryUserAuthorityInfo(CookiesMgr.VEST());
80 | }
81 | }
82 |
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/_EditorUI.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 | import java.awt.event.ActionEvent;
6 | import java.awt.event.ActionListener;
7 |
8 | import javax.swing.JButton;
9 | import javax.swing.JPanel;
10 | import javax.swing.JTextArea;
11 |
12 | import exp.bilibili.plugin.Config;
13 | import exp.bilibili.plugin.cache.MsgKwMgr;
14 | import exp.bilibili.plugin.utils.SwingUtils;
15 | import exp.libs.utils.io.FileUtils;
16 | import exp.libs.utils.other.StrUtils;
17 | import exp.libs.warp.ui.cpt.win.PopChildWindow;
18 |
19 | /**
20 | *
21 | * 公告/打call机编辑窗口
22 | *
23 | *
PROJECT : bilibili-plugin
24 | *
SUPPORT : www.exp-blog.com
25 | * @version 2017-12-17
26 | * @author EXP: 272629724@qq.com
27 | * @since jdk版本:jdk1.6
28 | */
29 | class _EditorUI extends PopChildWindow {
30 |
31 | private static final long serialVersionUID = -5197173910874606869L;
32 |
33 | private final static int WIDTH = 500;
34 |
35 | private final static int HEIGHT = 400;
36 |
37 | private JTextArea textTA;
38 |
39 | private JButton saveBtn;
40 |
41 | private String filePath;
42 |
43 | protected _EditorUI(String name, String filePath) {
44 | super(StrUtils.concat("[", name, "] 编辑器"), WIDTH, HEIGHT, false, filePath);
45 | }
46 |
47 | @Override
48 | protected void initComponents(Object... args) {
49 | this.saveBtn = new JButton("保存");
50 | saveBtn.setForeground(Color.BLACK);
51 |
52 | this.textTA = new JTextArea();
53 | if(args != null && args.length > 0) {
54 | this.filePath = args[0].toString();
55 | textTA.setText(FileUtils.read(filePath, Config.DEFAULT_CHARSET));
56 | }
57 | }
58 |
59 | @Override
60 | protected void setComponentsLayout(JPanel rootPanel) {
61 | rootPanel.add(SwingUtils.addAutoScroll(textTA), BorderLayout.CENTER);
62 | rootPanel.add(saveBtn, BorderLayout.SOUTH);
63 | }
64 |
65 | @Override
66 | protected void setComponentsListener(JPanel rootPanel) {
67 | saveBtn.addActionListener(new ActionListener() {
68 |
69 | @Override
70 | public void actionPerformed(ActionEvent e) {
71 | String text = textTA.getText();
72 | if(FileUtils.write(filePath, text, Config.DEFAULT_CHARSET, false)) {
73 | MsgKwMgr.getInstn().reload();
74 | SwingUtils.info("保存成功");
75 |
76 | } else {
77 | SwingUtils.warn("保存失败");
78 | }
79 | }
80 | });
81 | }
82 |
83 | @Override
84 | protected void AfterView() {
85 | // TODO Auto-generated method stub
86 |
87 | }
88 |
89 | @Override
90 | protected void beforeHide() {
91 | // TODO Auto-generated method stub
92 |
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/_NoticeUI.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui;
2 |
3 | import java.awt.BorderLayout;
4 |
5 | import javax.swing.JEditorPane;
6 | import javax.swing.JPanel;
7 |
8 | import exp.bilibili.plugin.utils.SwingUtils;
9 | import exp.libs.utils.other.StrUtils;
10 | import exp.libs.warp.ui.cpt.win.NoticeWindow;
11 |
12 | /**
13 | *
14 | * 直播通知面板
15 | *
16 | *
PROJECT : bilibili-plugin
17 | *
SUPPORT : www.exp-blog.com
18 | * @version 2017-12-17
19 | * @author EXP: 272629724@qq.com
20 | * @since jdk版本:jdk1.6
21 | */
22 | public class _NoticeUI extends NoticeWindow {
23 |
24 | /** serialVersionUID */
25 | private static final long serialVersionUID = -7835582158711626274L;
26 |
27 | private final static int WIDTH = 300;
28 |
29 | private final static int HEIGHT = 150;
30 |
31 | private JEditorPane editor;
32 |
33 | public _NoticeUI(int roomId) {
34 | super("直播通知", WIDTH, HEIGHT, false, roomId);
35 | }
36 |
37 | @Override
38 | protected void initComponents(Object... args) {
39 | this.editor = new JEditorPane();
40 | editor.setEditable(false);
41 | editor.setContentType("text/html"); // 将编辑框设置为支持html的编辑格式
42 |
43 | if(args != null && args.length > 0) {
44 | Integer roomId = (Integer) args[0];
45 | editor.setText(getNoticeText(roomId));
46 | }
47 | }
48 |
49 | @Override
50 | protected void setComponentsLayout(JPanel rootPanel) {
51 | rootPanel.add(SwingUtils.addBorder(editor), BorderLayout.CENTER);
52 | }
53 |
54 | @Override
55 | protected void setComponentsListener(JPanel rootPanel) {
56 | // TODO Auto-generated method stub
57 |
58 | }
59 |
60 | private String getNoticeText(int roomId) {
61 | String text = StrUtils.concat(
62 | "",
63 | "",
64 | "直播间 [", roomId, "] 开播啦!!!",
65 | "",
66 | ""
67 | );
68 | return text;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/__LoginCallback.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui;
2 |
3 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
4 |
5 | /**
6 | *
7 | * 登陆成功后的回调接口
8 | *
9 | *
PROJECT : bilibili-plugin
10 | *
SUPPORT : www.exp-blog.com
11 | * @version 2018-01-31
12 | * @author EXP: 272629724@qq.com
13 | * @since jdk版本:jdk1.6
14 | */
15 | public interface __LoginCallback {
16 |
17 | /**
18 | * 登录成功后触发
19 | * @param cookie 登录成功后的cookie
20 | */
21 | public void afterLogin(final BiliCookie cookie);
22 |
23 | /**
24 | * 注销成功后触发
25 | * @param cookie 注销前的cookie
26 | */
27 | public void afterLogout(final BiliCookie cookie);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/login/QRLogin.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui.login;
2 |
3 | import exp.bilibili.plugin.Config;
4 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
5 | import exp.bilibili.plugin.cache.CookiesMgr;
6 | import exp.bilibili.plugin.envm.CookieType;
7 | import exp.bilibili.protocol.XHRSender;
8 | import exp.libs.utils.img.QRCodeUtils;
9 | import exp.libs.utils.other.StrUtils;
10 | import exp.libs.utils.verify.RegexUtils;
11 | import exp.libs.warp.thread.LoopThread;
12 |
13 | /**
14 | *
15 | * 二维码登陆.
16 | * 可用于登陆主号、小号、马甲号
17 | *
18 | *
PROJECT : bilibili-plugin
19 | *
SUPPORT : www.exp-blog.com
20 | * @version 2017-12-17
21 | * @author EXP: 272629724@qq.com
22 | * @since jdk版本:jdk1.6
23 | */
24 | class QRLogin extends LoopThread {
25 |
26 | private final static String IMG_DIR = Config.getInstn().IMG_DIR();
27 |
28 | private final static String QRIMG_PATH = IMG_DIR.concat("/qrcode.png");
29 |
30 | private final static int WIDTH = 140;
31 |
32 | private final static int HEIGHT = 140;
33 |
34 | private final static String RGX_OAUTH = "oauthKey=([^&]+)";
35 |
36 | /** B站二维码有效时间是180s, 这里设置120s, 避免边界问题 */
37 | private final static long UPDATE_TIME = 120000;
38 |
39 | private final static long LOOP_TIME = 1000;
40 |
41 | private final static int LOOP_LIMIT = (int) (UPDATE_TIME / LOOP_TIME);
42 |
43 | private int loopCnt;
44 |
45 | private String oauthKey;
46 |
47 | private boolean isLogined;
48 |
49 | private CookieType type;
50 |
51 | private BiliCookie cookie;
52 |
53 | private QRLoginUI qrUI;
54 |
55 | protected QRLogin(QRLoginUI qrUI, CookieType type) {
56 | super("二维码登陆器");
57 | this.loopCnt = LOOP_LIMIT;
58 | this.oauthKey = "";
59 | this.isLogined = false;
60 | this.type = type;
61 | this.cookie = BiliCookie.NULL;
62 | this.qrUI = qrUI;
63 | }
64 |
65 | @Override
66 | protected void _before() {
67 | // Undo
68 | }
69 |
70 | @Override
71 | protected void _loopRun() {
72 | if(isLogined == true) {
73 | _stop(); // 若登陆成功则退出轮询
74 |
75 | } else {
76 |
77 | // 在二维码失效前更新图片
78 | if(loopCnt >= LOOP_LIMIT) {
79 | if(downloadQrcode(QRIMG_PATH)) {
80 | qrUI.updateQrcodeImg(QRIMG_PATH);
81 | loopCnt = 0;
82 | }
83 | }
84 |
85 | // 检测是否已扫码登陆成功
86 | cookie = XHRSender.toLogin(oauthKey);
87 | if(BiliCookie.NULL != cookie) {
88 | if(CookiesMgr.checkLogined(cookie)) {
89 | isLogined = true;
90 |
91 | } else {
92 | isLogined = false;
93 | loopCnt = LOOP_LIMIT; // 登陆失败, 下一次轮询直接刷新二维码
94 | }
95 | }
96 | }
97 |
98 | // 更新二维码有效期
99 | qrUI.updateQrcodeTips(LOOP_LIMIT - (loopCnt++));
100 | _sleep(LOOP_TIME);
101 | }
102 |
103 | @Override
104 | protected void _after() {
105 | if(isLogined == true) {
106 | CookiesMgr.getInstn().add(cookie, type);
107 | }
108 | qrUI._hide();
109 | }
110 |
111 | /**
112 | * 下载登陆二维码
113 | * @param imgPath 下载二维码路径
114 | * @return
115 | */
116 | private boolean downloadQrcode(String imgPath) {
117 | String url = XHRSender.getQrcodeInfo();
118 | oauthKey = RegexUtils.findFirst(url, RGX_OAUTH);
119 |
120 | boolean isOk = false;
121 | if(StrUtils.isNotEmpty(oauthKey)) {
122 | isOk = QRCodeUtils.toQRCode(url, WIDTH, HEIGHT, imgPath);
123 | }
124 | return isOk;
125 | }
126 |
127 | public BiliCookie getCookie() {
128 | return cookie;
129 | }
130 |
131 | }
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/login/QRLoginUI.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui.login;
2 |
3 | import java.awt.BorderLayout;
4 | import java.awt.Color;
5 |
6 | import javax.swing.ImageIcon;
7 | import javax.swing.JLabel;
8 | import javax.swing.JPanel;
9 |
10 | import exp.bilibili.plugin.Config;
11 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
12 | import exp.bilibili.plugin.envm.CookieType;
13 | import exp.bilibili.plugin.utils.SwingUtils;
14 | import exp.libs.utils.io.FileUtils;
15 | import exp.libs.utils.other.StrUtils;
16 | import exp.libs.warp.ui.cpt.win.PopChildWindow;
17 |
18 | /**
19 | *
20 | * 二维码登陆窗口.
21 | * 可用于登陆主号、小号、马甲号
22 | *
23 | *
PROJECT : bilibili-plugin
24 | *
SUPPORT : www.exp-blog.com
25 | * @version 2017-12-17
26 | * @author EXP: 272629724@qq.com
27 | * @since jdk版本:jdk1.6
28 | */
29 | class QRLoginUI extends PopChildWindow {
30 |
31 | /** serialVersionUID */
32 | private final static long serialVersionUID = 3032128610929327304L;
33 |
34 | private final static String IMG_DIR = Config.getInstn().IMG_DIR();
35 |
36 | private final static String TIPS_PATH = IMG_DIR.concat("/qrTips.png");
37 |
38 | private final static String TIPS = "正在更新二维码...";
39 |
40 | private final static int WIDTH = 300;
41 |
42 | private final static int HEIGHT = 320;
43 |
44 | private JLabel imgLabel;
45 |
46 | private JLabel tipLabel;
47 |
48 | private CookieType type;
49 |
50 | private QRLogin qrLogin;
51 |
52 | protected QRLoginUI(CookieType type) {
53 | super("哔哩哔哩-APP扫码登陆", WIDTH, HEIGHT, false, type);
54 | }
55 |
56 | @Override
57 | protected void initComponents(Object... args) {
58 | if(args != null && args.length > 0) {
59 | this.type = (CookieType) args[0];
60 | } else {
61 | this.type = CookieType.UNKNOW;
62 | }
63 |
64 | this.imgLabel = new JLabel(new ImageIcon(TIPS_PATH));
65 | this.tipLabel = new JLabel(TIPS);
66 | tipLabel.setForeground(Color.RED);
67 | }
68 |
69 | @Override
70 | protected void setComponentsLayout(JPanel rootPanel) {
71 | rootPanel.add(imgLabel, BorderLayout.CENTER);
72 | JPanel btnPanel = SwingUtils.getHFlowPanel(
73 | new JLabel(" "), tipLabel, new JLabel(" "));
74 | rootPanel.add(btnPanel, BorderLayout.SOUTH);
75 | }
76 |
77 | @Override
78 | protected void setComponentsListener(JPanel rootPanel) {
79 | // Undo
80 | }
81 |
82 | @Override
83 | protected void AfterView() {
84 | this.qrLogin = new QRLogin(this, type);
85 | qrLogin._start();
86 | }
87 |
88 | @Override
89 | protected void beforeHide() {
90 | qrLogin._stop();
91 | }
92 |
93 | protected void updateQrcodeImg(String imgPath) {
94 | if(FileUtils.exists(imgPath)) {
95 | SwingUtils.setImage(imgLabel, imgPath, 200, 200);
96 | }
97 | }
98 |
99 | protected void updateQrcodeTips(int time) {
100 | if(time < 0) {
101 | tipLabel.setText(TIPS);
102 |
103 | } else {
104 | String sTime = StrUtils.leftPad(String.valueOf(time), '0', 3);
105 | tipLabel.setText(StrUtils.concat("有效时间 : ", sTime, " 秒"));
106 | }
107 | }
108 |
109 | protected BiliCookie getCookie() {
110 | return qrLogin.getCookie();
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/ui/login/VCLogin.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.ui.login;
2 |
3 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
4 | import exp.bilibili.protocol.XHRSender;
5 |
6 | /**
7 | *
8 | * 帐密登陆.
9 | * 可用于登陆主号、小号、马甲号
10 | *
11 | *
PROJECT : bilibili-plugin
12 | *
SUPPORT : www.exp-blog.com
13 | * @version 2017-12-17
14 | * @author EXP: 272629724@qq.com
15 | * @since jdk版本:jdk1.6
16 | */
17 | class VCLogin {
18 |
19 | protected VCLogin() {}
20 |
21 | /**
22 | * 下载登陆用的验证码图片
23 | * @param imgPath 图片保存路径
24 | * @return 与该验证码配套的cookies
25 | */
26 | protected static String downloadVccode(String imgPath) {
27 | return XHRSender.downloadVccode(imgPath);
28 | }
29 |
30 | /**
31 | * 使用帐密+验证码的方式登录
32 | * @param username 账号
33 | * @param password 密码
34 | * @param vccode 验证码
35 | * @param vcCookies 与验证码配套的cookies
36 | * @return
37 | */
38 | protected static BiliCookie toLogin(String username, String password,
39 | String vccode, String vcCookies) {
40 | BiliCookie cookie = XHRSender.toLogin(username, password, vccode, vcCookies);
41 | if(cookie != BiliCookie.NULL) {
42 | XHRSender.queryUserInfo(cookie);
43 | }
44 | return cookie;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/utils/SwingUtils.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils;
2 |
3 | import javax.swing.JOptionPane;
4 |
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 |
8 | import exp.bilibili.plugin.Config;
9 |
10 | public class SwingUtils extends exp.libs.warp.ui.SwingUtils {
11 |
12 | private final static Logger log = LoggerFactory.getLogger(SwingUtils.class);
13 |
14 | /**
15 | * 信息弹窗
16 | * @param msg 普通消息
17 | */
18 | public static void info(String msg) {
19 | if(Config.USE_UI()) {
20 | JOptionPane.showMessageDialog(
21 | null, msg, "INFO", JOptionPane.INFORMATION_MESSAGE);
22 | } else {
23 | log.info(msg);
24 | }
25 | }
26 |
27 | /**
28 | * 警告弹窗
29 | * @param msg 警告消息
30 | */
31 | public static void warn(String msg) {
32 | if(Config.USE_UI()) {
33 | JOptionPane.showMessageDialog(
34 | null, msg, "WARN", JOptionPane.WARNING_MESSAGE);
35 | } else {
36 | log.warn(msg);
37 | }
38 | }
39 |
40 | /**
41 | * 异常弹窗
42 | * @param e 异常
43 | * @param msg 异常消息
44 | */
45 | public static void error(Throwable e, String msg) {
46 | if(Config.USE_UI()) {
47 | JOptionPane.showMessageDialog(
48 | null, msg, "ERROR", JOptionPane.ERROR_MESSAGE);
49 | if(e != null) {
50 | e.printStackTrace();
51 | }
52 | } else {
53 | log.error(msg, e);
54 | }
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/utils/Switch.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils;
2 |
3 | import exp.bilibili.plugin.Config;
4 | import exp.bilibili.plugin.cache.StormScanner;
5 | import exp.bilibili.plugin.ui.AppUI;
6 |
7 | /**
8 | *
9 | * 全局开关类
10 | *
11 | *
PROJECT : bilibili-plugin
12 | *
SUPPORT : www.exp-blog.com
13 | * @version 2017-12-17
14 | * @author EXP: 272629724@qq.com
15 | * @since jdk版本:jdk1.6
16 | */
17 | public class Switch {
18 |
19 | protected Switch() {}
20 |
21 | /**
22 | * 是否参加全平台抽奖(含小电视、高能、摩天大楼)
23 | * @return
24 | */
25 | public static boolean isJoinLottery() {
26 | boolean isJoin = true;
27 | if(Config.USE_UI()) {
28 | isJoin = AppUI.getInstn().isJoinLottery();
29 | }
30 | return isJoin;
31 | }
32 |
33 | /**
34 | * 是否参加节奏风暴抽奖
35 | * @return
36 | */
37 | public static boolean isJoinStorm() {
38 | boolean isJoin = true;
39 | if(Config.USE_UI()) {
40 | isJoin = StormScanner.getInstn().isScan();
41 | }
42 | return isJoin;
43 | }
44 |
45 | /**
46 | * 是否参加舰队抽奖
47 | * @return
48 | */
49 | public static boolean isJoinGuard() {
50 | boolean isJoin = true;
51 | if(Config.USE_UI()) {
52 | isJoin = StormScanner.getInstn().isScan();
53 | }
54 | return isJoin;
55 | }
56 |
57 | /**
58 | * 是否激活自动投喂
59 | * @return
60 | */
61 | public static boolean isAutoFeed() {
62 | boolean isAuto = false;
63 | if(Config.USE_UI()) {
64 | isAuto = AppUI.getInstn().isAutoFeed();
65 | }
66 | return isAuto;
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/utils/TensorFlowUtils.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils;
2 |
3 | import java.awt.image.BufferedImage;
4 |
5 | import exp.libs.algorithm.dl.tensorflow.TensorFlow;
6 | import exp.libs.utils.img.ImageUtils;
7 | import exp.libs.utils.io.FileUtils;
8 |
9 | /**
10 | *
11 | * TensorFlow深度学习模型接口
12 | *
13 | *
PROJECT : bilibili-plugin
14 | *
SUPPORT : www.exp-blog.com
15 | * @version 2017-12-17
16 | * @author EXP: 272629724@qq.com
17 | * @since jdk版本:jdk1.6
18 | */
19 | public class TensorFlowUtils {
20 |
21 | /** 已训练好的验证码模型 */
22 | private final static String PB_PATH = "./conf/tensorflow/storm-captch.pb";
23 |
24 | /** TensorFlow接口 */
25 | private final static TensorFlow _TF = new TensorFlow(PB_PATH);
26 |
27 | /** 验证码图片宽度 */
28 | private final static int IMG_WIDTH = 112;
29 |
30 | /** 验证码图片高度 */
31 | private final static int IMG_HEIGHT = 32;
32 |
33 | /** 验证码图片中含有的字符个数 */
34 | private final static int CHAR_NUM = 5;
35 |
36 | /**
37 | * 验证码图片中的字符的取值范围:
38 | * 26(小写英文字符) + 10(数字)
39 | */
40 | private final static int CHAR_RANGE = 36;
41 |
42 | /** 私有化构造函数 */
43 | protected TensorFlowUtils() {}
44 |
45 | /**
46 | * 把图像识别成文本内容
47 | * @param imgPath
48 | * @return
49 | */
50 | public static String imgToTxt(String imgPath) {
51 | if(!FileUtils.exists(PB_PATH)) {
52 | return "";
53 | }
54 |
55 | // 读取图片数据并转换为二进制格式(黑色为0,白色为1)
56 | BufferedImage image = ImageUtils.read(imgPath);
57 | BufferedImage binaryImage = ImageUtils.toBinary(image);
58 | float[] inputImage = _TF.loadImage(binaryImage);
59 |
60 | // 输入张量image_input: 待解析的二进制图片数据
61 | _TF.setInput("image_input", inputImage, IMG_WIDTH, IMG_HEIGHT);
62 |
63 | // 输入张量keep_prob: 神经元被选中的概率,用于防过拟合,取值0~1.0,值越大训练越快,但准确率越低; 但使用模型时固定为1即可
64 | _TF.setInput("keep_prob", new float[] { 1.0f }, 1);
65 |
66 | // 获取此CNN模型的输出张量:
67 | // 张量维度为 180 = 5x36 (26+10), 每行可解析为一个验证码字符
68 | float[] output = _TF.getOutput("final_output");
69 |
70 | // 分析输出张量,得到最终解(取输出张量矩阵每行最大值的索引值)
71 | int[] idxs = _TF.argmax(output, CHAR_NUM, CHAR_RANGE, 1);
72 |
73 | // 把索引值解析成字符
74 | StringBuilder captch = new StringBuilder();
75 | for(int idx : idxs) {
76 | if(idx < 26) { // 解析为小写英文字母
77 | captch.append((char) (idx + 'a'));
78 |
79 | } else { // 解析为数字
80 | captch.append((char) (idx - 26 + '0'));
81 | }
82 | }
83 | return captch.toString();
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/plugin/utils/TimeUtils.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils;
2 |
3 | import java.util.Date;
4 |
5 | import exp.libs.envm.DateFormat;
6 | import exp.libs.utils.num.NumUtils;
7 | import exp.libs.utils.other.StrUtils;
8 |
9 | /**
10 | *
11 | * 时间工具类
12 | *
13 | *
PROJECT : bilibili-plugin
14 | *
SUPPORT : www.exp-blog.com
15 | * @version 2017-12-17
16 | * @author EXP: 272629724@qq.com
17 | * @since jdk版本:jdk1.6
18 | */
19 | public class TimeUtils extends exp.libs.utils.time.TimeUtils {
20 |
21 | protected TimeUtils() {}
22 |
23 | /**
24 | * 获取当前时间
25 | * @return [HH:mm:ss]
26 | */
27 | public static String getCurTime() {
28 | String time = toStr(System.currentTimeMillis(), DateFormat.HMS);
29 | return StrUtils.concat("[", time, "] ");
30 | }
31 |
32 | /**
33 | * 检查当前时间是否为晚上(18:00~24:00)
34 | * @return
35 | */
36 | public static boolean isNight() {
37 | int hour = TimeUtils.getCurHour(PEKING_HOUR_OFFSET);
38 | return (hour >= 18 && hour < 24);
39 | }
40 |
41 | /**
42 | * 检查当前时间是否为凌晨(1:00~6:00)
43 | * @return
44 | */
45 | public static boolean isDawn() {
46 | int hour = TimeUtils.getCurHour(PEKING_HOUR_OFFSET);
47 | return (hour >= 1 && hour < 7);
48 | }
49 |
50 | /**
51 | * 检查当前时间是否为0点附近(23:00~1:00)
52 | * @return
53 | */
54 | public static boolean inZeroPointRange() {
55 | final long ZERO = TimeUtils.getZeroPointMillis(PEKING_HOUR_OFFSET) + DAY_UNIT; // 当前24点
56 | final long RANGE_BGN = ZERO - HOUR_UNIT; // 当天23点
57 | final long RANGE_END = ZERO + HOUR_UNIT; // 明天1点
58 | long now = System.currentTimeMillis();
59 | return (now >= RANGE_BGN && now <= RANGE_END);
60 | }
61 |
62 | /**
63 | * 获取本期时间
64 | * @return yyyyMM 格式, 如: 201801
65 | */
66 | public static int getCurPeriod() {
67 | return NumUtils.toInt(TimeUtils.toStr(new Date(), "yyyyMM"), 0);
68 | }
69 |
70 | /**
71 | * 获取上期时间
72 | * @return yyyyMM 格式, 如: 201712
73 | */
74 | public static int getLastPeriod() {
75 | return getLastPeriod(getCurPeriod());
76 | }
77 |
78 | /**
79 | * 获取上期时间
80 | * @param curPeriod 本期时间, yyyyMM 格式, 如: 201801
81 | * @return yyyyMM 格式, 如: 201712
82 | */
83 | public static int getLastPeriod(int curPeriod) {
84 | int period = curPeriod;
85 | if(period % 100 == 1) {
86 | period = period - 101 + 12;
87 | } else {
88 | period = period - 1;
89 | }
90 | return period;
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/other/AppVideo.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.other;
2 |
3 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
4 | import exp.bilibili.plugin.cache.RoomMgr;
5 | import exp.bilibili.protocol.xhr.Other;
6 | import exp.bilibili.protocol.xhr.WatchLive;
7 | import exp.libs.utils.num.IDUtils;
8 |
9 | /**
10 | *
11 | * 手机直播的视频参数对象
12 | *
13 | *
PROJECT : bilibili-plugin
14 | *
SUPPORT : www.exp-blog.com
15 | * @version 2018-02-11
16 | * @author EXP: 272629724@qq.com
17 | * @since jdk版本:jdk1.6
18 | */
19 | public class AppVideo {
20 |
21 | /** 秒单位 */
22 | private final static int SEC_UNIT = 1000;
23 |
24 | /** URL有效期:半小时 */
25 | private final static int EXPIRES = 1800;
26 |
27 | /** 所观看直播的真实房间号 */
28 | private String roomId;
29 |
30 | /** 所观看直播的主播信息 */
31 | private User up;
32 |
33 | /** 每次更新手机直播视频地址后, 重新生成的GUID (FIXME: 生成规则未知) */
34 | private String guid;
35 |
36 | /** 当前手机直播视频地址URL(每次更新后有效期为半小时) */
37 | private String url;
38 |
39 | /** 每次更新手机直播视频地址后, 开始观看视频的时间点 */
40 | private long createTime;
41 |
42 | /** 每次更新手机直播视频地址后, 该视频可以观看的有效时间 */
43 | private long expiresTime;
44 |
45 | /** 上一次观看这个视频 的时间点 */
46 | private long lastViewTime;
47 |
48 | /**
49 | * 构造函数
50 | * @param roomId 直播间号
51 | */
52 | public AppVideo() {
53 | this.roomId = "";
54 | this.up = User.NULL;
55 | this.guid = "";
56 | this.url = "";
57 | this.createTime = 0;
58 | this.expiresTime = 0;
59 | }
60 |
61 | /**
62 | * 更新所观看的直播视频信息
63 | * @param cookie 观看者的cookie
64 | * @param roomId 所观看的直播房间号
65 | */
66 | public void update(BiliCookie cookie, int roomId) {
67 | this.roomId = String.valueOf(RoomMgr.getInstn().getRealRoomId(roomId));
68 | this.up = Other.queryUpInfo(roomId);
69 | this.guid = IDUtils.getUUID().replace("-", "");
70 | this.url = WatchLive.getAppVideoURL(cookie, roomId);
71 | this.createTime = System.currentTimeMillis() / SEC_UNIT;
72 | this.expiresTime = (createTime + EXPIRES) * SEC_UNIT; // URL有效期半小时
73 | this.lastViewTime = createTime;
74 | }
75 |
76 | public boolean isVaild() {
77 | return (System.currentTimeMillis() <= expiresTime);
78 | }
79 |
80 | public String getRoomId() {
81 | return roomId;
82 | }
83 |
84 | public String getUpId() {
85 | return up.ID();
86 | }
87 |
88 | public int getUpLv() {
89 | return up.LV();
90 | }
91 |
92 | public String getGuid() {
93 | return guid;
94 | }
95 |
96 | public String getUrl() {
97 | return url;
98 | }
99 |
100 | public long getCreateTime() {
101 | return createTime;
102 | }
103 |
104 | public long getExpiresTime() {
105 | return expiresTime;
106 | }
107 |
108 | public int getDeltaSecond() {
109 | long now = System.currentTimeMillis() / 1000;
110 | long delta = now - lastViewTime;
111 | lastViewTime = now;
112 | return (int) delta;
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/other/LotteryRoom.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.other;
2 |
3 | import exp.bilibili.plugin.envm.LotteryType;
4 | import exp.libs.utils.other.StrUtils;
5 |
6 | /**
7 | *
8 | * 抽奖房间
9 | *
10 | *
PROJECT : bilibili-plugin
11 | *
SUPPORT : www.exp-blog.com
12 | * @version 2017-12-17
13 | * @author EXP: 272629724@qq.com
14 | * @since jdk版本:jdk1.6
15 | */
16 | public class LotteryRoom {
17 |
18 | /** 抽奖房间号 */
19 | private int roomId;
20 |
21 | /** 抽奖所在直播间地址 */
22 | private String url;
23 |
24 | /** 抽奖开始时间 */
25 | private long startTime;
26 |
27 | /** 抽奖类型 */
28 | private LotteryType type;
29 |
30 | public LotteryRoom(int roomId, String url, LotteryType type) {
31 | this.roomId = roomId;
32 | this.url = (StrUtils.isEmpty(url) ? "" : url);
33 | this.startTime = System.currentTimeMillis();
34 | this.type = (type == null ? LotteryType.ENGERY : type);
35 | }
36 |
37 | public int getRoomId() {
38 | return roomId;
39 | }
40 |
41 | public String getUrl() {
42 | return url;
43 | }
44 |
45 | public long getStartTime() {
46 | return startTime;
47 | }
48 |
49 | public LotteryType TYPE() {
50 | return type;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/other/User.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.other;
2 |
3 | import exp.libs.utils.other.StrUtils;
4 |
5 | /**
6 | *
7 | * 主播/房管/用户对象
8 | *
9 | *
PROJECT : bilibili-plugin
10 | *
SUPPORT : www.exp-blog.com
11 | * @version 2017-12-17
12 | * @author EXP: 272629724@qq.com
13 | * @since jdk版本:jdk1.6
14 | */
15 | public class User {
16 |
17 | public final static User NULL = new User("", "", 0);
18 |
19 | private String id;
20 |
21 | private String name;
22 |
23 | private int level;
24 |
25 | public User(String id, String name) {
26 | this(id, name, 0);
27 | }
28 |
29 | public User(String id, String name, int level) {
30 | this.id = (id == null ? "" : id);
31 | this.name = (name == null ? "" : name);
32 | this.level = (level < 0 ? 0 : level);
33 | }
34 |
35 | public String ID() {
36 | return id;
37 | }
38 |
39 | public String NAME() {
40 | return name;
41 | }
42 |
43 | public int LV() {
44 | return level;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return StrUtils.concat(ID(), "(", LV(), ")", ":", NAME());
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/ActivityBannerRedNoticeClose.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | 红色活动横幅通知事件:
11 | {
12 | "cmd": "ACTIVITY_BANNER_RED_NOTICE_CLOSE",
13 | "data": {
14 | "id": 297,
15 | "type": "revenue_banner"
16 | }
17 | }
18 | *
19 | * @version 2017-12-17
20 | * @author EXP: 272629724@qq.com
21 | * @since jdk版本:jdk1.6
22 | */
23 | public class ActivityBannerRedNoticeClose extends _Msg {
24 |
25 | public ActivityBannerRedNoticeClose(JSONObject json) {
26 | super(json);
27 | this.cmd = BiliCmd.ACTIVITY_BANNER_RED_NOTICE_CLOSE;
28 | }
29 |
30 | @Override
31 | protected void analyse(JSONObject json) {
32 | // Undo
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/ActivityEvent.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | 2018春节活动-红灯笼高能通知事件:
11 | {
12 | "cmd": "ACTIVITY_EVENT",
13 | "data": {
14 | "keyword": "newspring_2018",
15 | "type": "cracker",
16 | "limit": 300000,
17 | "progress": 59334
18 | }
19 | }
20 | *
21 | * @version 2017-12-17
22 | * @author EXP: 272629724@qq.com
23 | * @since jdk版本:jdk1.6
24 | */
25 | public class ActivityEvent extends _Msg {
26 |
27 | public ActivityEvent(JSONObject json) {
28 | super(json);
29 | this.cmd = BiliCmd.ACTIVITY_EVENT;
30 | }
31 |
32 | @Override
33 | protected void analyse(JSONObject json) {
34 | // Undo
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/ChatMsg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONArray;
4 | import net.sf.json.JSONObject;
5 | import exp.bilibili.protocol.envm.BiliCmd;
6 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
7 | import exp.libs.utils.format.JsonUtils;
8 | import exp.libs.utils.other.StrUtils;
9 |
10 | /**
11 | *
12 | *
13 | *
14 | 直播间弹幕消息:
15 | {
16 | "info": [
17 | [
18 | 0,
19 | 1,
20 | 25,
21 | 16772431,
22 | 1513270027,
23 | "1513257498",
24 | 0,
25 | "53d7c7bc",
26 | 0
27 | ],
28 | "弹幕消息内容",
29 | [
30 | 1650868,
31 | "M-亚絲娜",
32 | 0,
33 | 1,
34 | 1,
35 | 10000,
36 | 1,
37 | "" // 这是后面版本突然多出来的一个元素
38 | ],
39 | [
40 | 16,
41 | "高达",
42 | "M斯文败类",
43 | "51108",
44 | 16746162,
45 | ""
46 | ],
47 | [
48 | 43,
49 | 0,
50 | 16746162,
51 | 4967
52 | ],
53 | [
54 | "task-year",
55 | "title-29-1"
56 | ],
57 | 2,
58 | 2
59 | ],
60 | "cmd": "DANMU_MSG"
61 | }
62 | *
63 | * @version 2017-12-17
64 | * @author EXP: 272629724@qq.com
65 | * @since jdk版本:jdk1.6
66 | */
67 | public class ChatMsg extends _Msg {
68 |
69 | private String uid;
70 |
71 | private String username;
72 |
73 | /** 头衔 (老爷+船员)*/
74 | private String title;
75 |
76 | /** 勋章(含等级) */
77 | private String medal;
78 |
79 | /** 用户等级 */
80 | private String level;
81 |
82 | private String msg;
83 |
84 | public ChatMsg(JSONObject json) {
85 | super(json);
86 | this.cmd = BiliCmd.DANMU_MSG;
87 | }
88 |
89 | @Override
90 | protected void analyse(JSONObject json) {
91 | JSONArray infos = JsonUtils.getArray(json, BiliCmdAtrbt.info);
92 | for(int i = 0; i < infos.size(); i++) {
93 | Object info = infos.get(i);
94 |
95 | if(info instanceof JSONArray) {
96 | JSONArray array = (JSONArray) info;
97 |
98 | // 未知信息
99 | if(array.size() == 9) {
100 | // Undo
101 |
102 | // 发起聊天的用户信息
103 | } else if(array.size() == 7 || array.size() == 8) {
104 | this.uid = array.getString(0);
105 | this.username = array.getString(1);
106 |
107 | // 发起聊天的用户所佩戴的勋章信息
108 | } else if(array.size() == 6) {
109 | String lv = array.getString(0);
110 | String desc = array.getString(1);
111 | this.medal = StrUtils.concat(desc, "(", lv, ")");
112 |
113 | // 发起聊天的用户的等级信息
114 | } else if(array.size() == 4) {
115 | this.level = array.getString(0);
116 |
117 | // 发起聊天的用户所拥有的头衔(老爷/船员)
118 | } else if(array.size() <= 2) {
119 | // Undo
120 | }
121 |
122 | } else if(info instanceof String) {
123 | this.msg = (String) info;
124 |
125 | } else {
126 | // Undo
127 | }
128 | }
129 | }
130 |
131 | public String getUid() {
132 | return uid;
133 | }
134 |
135 | public String getUsername() {
136 | return username;
137 | }
138 |
139 | public String getTitle() {
140 | return title;
141 | }
142 |
143 | public String getMedal() {
144 | return medal;
145 | }
146 |
147 | public String getLevel() {
148 | return level;
149 | }
150 |
151 | public String getMsg() {
152 | return msg;
153 | }
154 |
155 | }
156 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/ComboEnd.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)礼物combo连击结束消息:
13 | {
14 | "cmd": "COMBO_END",
15 | "data": {
16 | "uname": "东方晟",
17 | "r_uname": "叶落莫言",
18 | "combo_num": 4,
19 | "price": 233,
20 | "gift_name": "233",
21 | "gift_id": 8,
22 | "start_time": 1529550034,
23 | "end_time": 1529550035
24 | }
25 | }
26 | *
27 | * @version 2017-12-17
28 | * @author EXP: 272629724@qq.com
29 | * @since jdk版本:jdk1.6
30 | */
31 | public class ComboEnd extends _Msg {
32 |
33 | private String uname;
34 |
35 | private String upName;
36 |
37 | private int comboNum;
38 |
39 | private String giftId;
40 |
41 | public ComboEnd(JSONObject json) {
42 | super(json);
43 | this.cmd = BiliCmd.COMBO_END;
44 | }
45 |
46 | @Override
47 | protected void analyse(JSONObject json) {
48 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
49 | this.uname = JsonUtils.getStr(data, BiliCmdAtrbt.uname);
50 | this.upName = JsonUtils.getStr(data, BiliCmdAtrbt.r_uname);
51 | this.comboNum = JsonUtils.getInt(data, BiliCmdAtrbt.combo_num, 0);
52 | this.giftId = JsonUtils.getStr(data, BiliCmdAtrbt.gift_id);
53 | }
54 | }
55 |
56 | public String getUname() {
57 | return uname;
58 | }
59 |
60 | public String getUpName() {
61 | return upName;
62 | }
63 |
64 | public int getComboNum() {
65 | return comboNum;
66 | }
67 |
68 | public String getGiftId() {
69 | return giftId;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/ComboSend.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)礼物combo连击消息:
13 | {
14 | "cmd": "COMBO_SEND",
15 | "data": {
16 | "uid": 298674880,
17 | "uname": "霞光舍不得臭猫呀",
18 | "combo_num": 5,
19 | "gift_name": "吃瓜",
20 | "gift_id": 20004,
21 | "action": "赠送",
22 | "combo_id": "gift:combo_id:298674880:27020889:20004:1538239401.4661"
23 | }
24 | }
25 | *
26 | * @version 2017-12-17
27 | * @author EXP: 272629724@qq.com
28 | * @since jdk版本:jdk1.6
29 | */
30 | public class ComboSend extends _Msg {
31 |
32 | private String uname;
33 |
34 | private int comboNum;
35 |
36 | private String giftId;
37 |
38 | private String comboIds;
39 |
40 | public ComboSend(JSONObject json) {
41 | super(json);
42 | this.cmd = BiliCmd.COMBO_SEND;
43 | }
44 |
45 | @Override
46 | protected void analyse(JSONObject json) {
47 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
48 | this.uname = JsonUtils.getStr(data, BiliCmdAtrbt.uname);
49 | this.comboIds = JsonUtils.getStr(data, BiliCmdAtrbt.combo_id);
50 | this.comboNum = JsonUtils.getInt(data, BiliCmdAtrbt.combo_num, 0);
51 | this.giftId = JsonUtils.getStr(data, BiliCmdAtrbt.gift_id);
52 | }
53 | }
54 |
55 | public String getUname() {
56 | return uname;
57 | }
58 |
59 | public String getComboIds() {
60 | return comboIds;
61 | }
62 |
63 | public int getComboNum() {
64 | return comboNum;
65 | }
66 |
67 | public String getGiftId() {
68 | return giftId;
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/DailyQuestNewday.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | 凌晨 00:00 新一天的通知事件:
11 | {
12 | "cmd": "DAILY_QUEST_NEWDAY",
13 | "data": {
14 |
15 | }
16 | }
17 | *
18 | * @version 2017-12-17
19 | * @author EXP: 272629724@qq.com
20 | * @since jdk版本:jdk1.6
21 | */
22 | public class DailyQuestNewday extends _Msg {
23 |
24 | public DailyQuestNewday(JSONObject json) {
25 | super(json);
26 | this.cmd = BiliCmd.DAILY_QUEST_NEWDAY;
27 | }
28 |
29 | @Override
30 | protected void analyse(JSONObject json) {
31 | // Undo
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/EnergyLottery.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 |
7 | /**
8 | *
9 | *
10 | *
11 | 高能礼物抽奖:
12 | {
13 | "cmd": "SYS_GIFT",
14 | "msg": "00\u515c\u515c00\u5728\u76f4\u64ad\u95f45279\u706b\u529b\u5168\u5f00\uff0c\u55e8\u7ffb\u5168\u573a\uff0c\u901f\u53bb\u56f4\u89c2\uff0c\u8fd8\u80fd\u514d\u8d39\u9886\u53d6\u706b\u529b\u7968\uff01",
15 | "msg_text": "00\u515c\u515c00\u5728\u76f4\u64ad\u95f45279\u706b\u529b\u5168\u5f00\uff0c\u55e8\u7ffb\u5168\u573a\uff0c\u901f\u53bb\u56f4\u89c2\uff0c\u8fd8\u80fd\u514d\u8d39\u9886\u53d6\u706b\u529b\u7968\uff01",
16 | "tips": "00\u515c\u515c00\u5728\u76f4\u64ad\u95f45279\u706b\u529b\u5168\u5f00\uff0c\u55e8\u7ffb\u5168\u573a\uff0c\u901f\u53bb\u56f4\u89c2\uff0c\u8fd8\u80fd\u514d\u8d39\u9886\u53d6\u706b\u529b\u7968\uff01",
17 | "url": "http:\/\/live.bilibili.com\/5279",
18 | "roomid": 5279,
19 | "real_roomid": 5279,
20 | "giftId": 106,
21 | "msgTips": 0
22 | }
23 | *
24 | * @version 2017-12-17
25 | * @author EXP: 272629724@qq.com
26 | * @since jdk版本:jdk1.6
27 | */
28 | public class EnergyLottery extends SysGift {
29 |
30 | private String tips;
31 |
32 | private String url;
33 |
34 | private int roomId;
35 |
36 | private int realRoomId;
37 |
38 | private String giftId;
39 |
40 | private String msgTips;
41 |
42 | public EnergyLottery(JSONObject json) {
43 | super(json);
44 | }
45 |
46 | public int ROOM_ID() {
47 | int id = getRealRoomId();
48 | return (id <= 0 ? getRoomId() : id);
49 | }
50 |
51 | @Override
52 | protected void analyse(JSONObject json) {
53 | super.analyse(json);
54 | this.tips = JsonUtils.getStr(json, BiliCmdAtrbt.tips);
55 | this.url = JsonUtils.getStr(json, BiliCmdAtrbt.url);
56 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
57 | this.realRoomId = JsonUtils.getInt(json, BiliCmdAtrbt.real_roomid, 0);
58 | this.giftId = JsonUtils.getStr(json, BiliCmdAtrbt.giftId);
59 | this.msgTips = JsonUtils.getStr(json, BiliCmdAtrbt.msgTips);
60 | }
61 |
62 | public String getTips() {
63 | return tips;
64 | }
65 |
66 | public String getUrl() {
67 | return url;
68 | }
69 |
70 | public int getRoomId() {
71 | return roomId;
72 | }
73 |
74 | public int getRealRoomId() {
75 | return realRoomId;
76 | }
77 |
78 | public String getGiftId() {
79 | return giftId;
80 | }
81 |
82 | public String getMsgTips() {
83 | return msgTips;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/EntryEffect.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 提督/总督/舰长进入直播间特效:
13 | {
14 | "cmd": "ENTRY_EFFECT",
15 | "data": {
16 | "id": 4,
17 | "uid": 6442532,
18 | "target_id": 20440696,
19 | "show_avatar": 1,
20 | "copy_writing": "欢迎舰长 <%李猫咪%> 进入直播间",
21 | "highlight_color": "#E6FF00",
22 | "basemap_url": "http:\\/\\/i0.hdslb.com\\/bfs\\/live\\/1fa3cc06258e16c0ac4c209e2645fda3c2791894.png",
23 | "effective_time": 2,
24 | "priority": 70,
25 | "privilege_type": 3,
26 | "face": "http:\\/\\/i0.hdslb.com\\/bfs\\/face\\/2760e2af67538fa2f243a111fa64eac74227635e.jpg"
27 | }
28 | }
29 | *
30 | * @version 2017-12-17
31 | * @author EXP: 272629724@qq.com
32 | * @since jdk版本:jdk1.6
33 | */
34 | public class EntryEffect extends _Msg {
35 |
36 | protected final static String[] GUARD = {
37 | "平民", "总督", "提督", "舰长"
38 | };
39 |
40 | protected String uid;
41 |
42 | protected String msg;
43 |
44 | protected int guardLevel;
45 |
46 | protected String guardDesc;
47 |
48 | public EntryEffect(JSONObject json) {
49 | super(json);
50 | this.cmd = BiliCmd.ENTRY_EFFECT;
51 | }
52 |
53 | @Override
54 | protected void analyse(JSONObject json) {
55 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
56 | this.uid = JsonUtils.getStr(data, BiliCmdAtrbt.uid);
57 | this.msg = JsonUtils.getStr(data, BiliCmdAtrbt.copy_writing);
58 | this.guardLevel = JsonUtils.getInt(data, BiliCmdAtrbt.guard_level, 0);
59 | guardLevel = (guardLevel >= GUARD.length ? 0 : guardLevel);
60 | this.guardDesc = GUARD[guardLevel];
61 | }
62 | }
63 |
64 | public String getUid() {
65 | return uid;
66 | }
67 |
68 | public String getMsg() {
69 | return msg;
70 | }
71 |
72 | public int getGuardLevel() {
73 | return guardLevel;
74 | }
75 |
76 | public String getGuardDesc() {
77 | return guardDesc;
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/GuardBuy.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)新船员上船消息
13 | {
14 | "cmd": "GUARD_BUY",
15 | "data": {
16 | "uid": 14356317,
17 | "username": "\u8865\u5200\u706c\u5200",
18 | "guard_level": 3,
19 | "num": 1
20 | },
21 | "roomid": "269706"
22 | }
23 | *
24 | * @version 2017-12-17
25 | * @author EXP: 272629724@qq.com
26 | * @since jdk版本:jdk1.6
27 | */
28 | public class GuardBuy extends WelcomeGuard {
29 |
30 | private int num;
31 |
32 | private int roomId;
33 |
34 | public GuardBuy(JSONObject json) {
35 | super(json);
36 | this.cmd = BiliCmd.GUARD_BUY;
37 | }
38 |
39 | @Override
40 | protected void analyse(JSONObject json) {
41 | super.analyse(json);
42 |
43 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
44 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
45 | this.num = JsonUtils.getInt(data, BiliCmdAtrbt.num, 0);
46 | }
47 | }
48 |
49 | public int getNum() {
50 | return num;
51 | }
52 |
53 | public int getRoomId() {
54 | return roomId;
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/GuardLotteryStart.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)新船员上船抽奖消息
13 | {
14 | "cmd": "GUARD_LOTTERY_START",
15 | "data": {
16 | "id": 473918,
17 | "roomid": 280446,
18 | "message": "睡不够的茜茜茜 在【280446】购买了舰长,请前往抽奖",
19 | "type": "guard",
20 | "privilege_type": 3,
21 | "link": "https:\\/\\/live.bilibili.com\\/280446",
22 | "payflow_id": "web_3e76de8043394a0908_201809",
23 | "lottery": {
24 | "id": 473918,
25 | "sender": {
26 | "uid": 9377231,
27 | "uname": "睡不够的茜茜茜",
28 | "face": "http:\\/\\/i2.hdslb.com\\/bfs\\/face\\/2d0a4ea2b7258e14289b8e8022fa8e7958e605c8.jpg"
29 | },
30 | "keyword": "guard",
31 | "time": 1200,
32 | "status": 1,
33 | "mobile_display_mode": 2,
34 | "mobile_static_asset": "",
35 | "mobile_animation_asset": ""
36 | }
37 | }
38 | }
39 | *
40 | * @version 2017-12-17
41 | * @author EXP: 272629724@qq.com
42 | * @since jdk版本:jdk1.6
43 | */
44 | public class GuardLotteryStart extends _Msg {
45 |
46 | private String msg;
47 |
48 | private int roomId;
49 |
50 | public GuardLotteryStart(JSONObject json) {
51 | super(json);
52 | this.cmd = BiliCmd.GUARD_LOTTERY_START;
53 | }
54 |
55 | @Override
56 | protected void analyse(JSONObject json) {
57 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
58 | this.msg = JsonUtils.getStr(data, BiliCmdAtrbt.message);
59 | this.roomId = JsonUtils.getInt(data, BiliCmdAtrbt.roomid, 0);
60 | }
61 | }
62 |
63 | public String getMsg() {
64 | return msg;
65 | }
66 |
67 | public int getRoomId() {
68 | return roomId;
69 | }
70 |
71 | }
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/GuardMsg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import exp.bilibili.protocol.envm.BiliCmd;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 | import exp.libs.utils.verify.RegexUtils;
7 | import net.sf.json.JSONObject;
8 |
9 | /**
10 | *
11 | *
12 | *
13 | (全频道)登船消息
14 | {
15 | "cmd": "GUARD_MSG",
16 | "msg": "用户 :?阿斗金:? 在主播 吃不饱的小黄瓜 的直播间开通了总督"
17 | }
18 | *
19 | * @version 2017-12-17
20 | * @author EXP: 272629724@qq.com
21 | * @since jdk版本:jdk1.6
22 | */
23 | public class GuardMsg extends _Msg {
24 |
25 | private String msg;
26 |
27 | private String liveup;
28 |
29 | private int roomId;
30 |
31 | private String url;
32 |
33 | public GuardMsg(JSONObject json) {
34 | super(json);
35 | this.cmd = BiliCmd.GUARD_MSG;
36 | this.roomId = 0;
37 | }
38 |
39 | @Override
40 | protected void analyse(JSONObject json) {
41 | this.msg = JsonUtils.getStr(json, BiliCmdAtrbt.msg);
42 | this.liveup = RegexUtils.findFirst(msg, "在主播 (\\S+) 的直播间");
43 | this.url = JsonUtils.getStr(json, BiliCmdAtrbt.url);
44 | }
45 |
46 | public String getMsg() {
47 | return msg;
48 | }
49 |
50 | public String getLiveup() {
51 | return liveup;
52 | }
53 |
54 | public int getRoomId() {
55 | return roomId;
56 | }
57 |
58 | public void setRoomId(int roomId) {
59 | this.roomId = roomId;
60 | }
61 |
62 | public String getUrl() {
63 | return url;
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/LiveMsg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import exp.bilibili.protocol.envm.BiliCmd;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 | import net.sf.json.JSONObject;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 开播通知
13 | {
14 | "cmd": "LIVE",
15 | "roomid": "269706",
16 | }
17 | *
18 | * @version 2017-12-17
19 | * @author EXP: 272629724@qq.com
20 | * @since jdk版本:jdk1.6
21 | */
22 | public class LiveMsg extends _Msg {
23 |
24 | private int roomId;
25 |
26 | public LiveMsg(JSONObject json) {
27 | super(json);
28 | this.cmd = BiliCmd.LIVE;
29 | }
30 |
31 | @Override
32 | protected void analyse(JSONObject json) {
33 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
34 | }
35 |
36 | public int getRoomId() {
37 | return roomId;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/Preparing.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 关播通知
13 | {
14 | "cmd": "PREPARING",
15 | "round": 1,
16 | "roomid": "269706"
17 | }
18 | *
19 | * @version 2017-12-17
20 | * @author EXP: 272629724@qq.com
21 | * @since jdk版本:jdk1.6
22 | */
23 | public class Preparing extends _Msg {
24 |
25 | private String roomId;
26 |
27 | public Preparing(JSONObject json) {
28 | super(json);
29 | this.cmd = BiliCmd.PREPARING;
30 | }
31 |
32 | @Override
33 | protected void analyse(JSONObject json) {
34 | this.roomId = JsonUtils.getStr(json, BiliCmdAtrbt.roomid);
35 | }
36 |
37 | public String getRoomId() {
38 | return roomId;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RaffleEnd.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)高能抽奖结束消息
13 | {
14 | "cmd": "RAFFLE_END",
15 | "roomid": 269706,
16 | "data": {
17 | "raffleId": 61825,
18 | "type": "openfire",
19 | "from": "\u9f20\u4e8c\u4e09\u4e09",
20 | "fromFace": "http:\/\/i2.hdslb.com\/bfs\/face\/4b309c88cc66c5d11558c47beb716b0fd8dd1438.jpg",
21 | "win": {
22 | "uname": "\u51b7\u7406Remonn",
23 | "face": "http:\/\/i2.hdslb.com\/bfs\/face\/4b309c88cc66c5d11558c47beb716b0fd8dd1438.jpg",
24 | "giftId": 105,
25 | "giftName": "\u706b\u529b\u7968",
26 | "giftNum": 50
27 | }
28 | }
29 | }
30 | *
31 | * @version 2017-12-17
32 | * @author EXP: 272629724@qq.com
33 | * @since jdk版本:jdk1.6
34 | */
35 | public class RaffleEnd extends RaffleStart {
36 |
37 | private String winner;
38 |
39 | private String giftName;
40 |
41 | private String giftNum;
42 |
43 | public RaffleEnd(JSONObject json) {
44 | super(json);
45 | this.cmd = BiliCmd.RAFFLE_END;
46 | }
47 |
48 | @Override
49 | protected void analyse(JSONObject json) {
50 | super.analyse(json);
51 |
52 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
53 | JSONObject win = JsonUtils.getObject(data, BiliCmdAtrbt.win); {
54 | this.winner = JsonUtils.getStr(win, BiliCmdAtrbt.uname);
55 | this.giftName = JsonUtils.getStr(win, BiliCmdAtrbt.giftName);
56 | this.giftNum = JsonUtils.getStr(win, BiliCmdAtrbt.giftNum);
57 | }
58 | }
59 | }
60 |
61 | public String getWinner() {
62 | return winner;
63 | }
64 |
65 | public String getGiftName() {
66 | return giftName;
67 | }
68 |
69 | public String getGiftNum() {
70 | return giftNum;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RaffleStart.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)高能抽奖开始消息
13 | {
14 | "cmd": "RAFFLE_START",
15 | "roomid": 269706,
16 | "data": {
17 | "raffleId": 61825,
18 | "type": "openfire",
19 | "from": "鼠二三三",
20 | "time": 60
21 | }
22 | }
23 | *
24 | * @version 2017-12-17
25 | * @author EXP: 272629724@qq.com
26 | * @since jdk版本:jdk1.6
27 | */
28 | public class RaffleStart extends _Msg {
29 |
30 | protected int roomId;
31 |
32 | protected String raffleId;
33 |
34 | protected String from;
35 |
36 | public RaffleStart(JSONObject json) {
37 | super(json);
38 | this.cmd = BiliCmd.RAFFLE_START;
39 | }
40 |
41 | @Override
42 | protected void analyse(JSONObject json) {
43 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
44 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
45 | this.raffleId = JsonUtils.getStr(data, BiliCmdAtrbt.raffleId);
46 | this.from = JsonUtils.getStr(data, BiliCmdAtrbt.from);
47 | }
48 | }
49 |
50 | public int getRoomId() {
51 | return roomId;
52 | }
53 |
54 | public String getRaffleId() {
55 | return raffleId;
56 | }
57 |
58 | public String getFrom() {
59 | return from;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RoomBlock.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | (直播间内)关小黑屋通知消息:
13 | {
14 | "cmd": "ROOM_BLOCK_MSG",
15 | "uid": "247056833",
16 | "uname": "hghi7432",
17 | "roomid": 269706
18 | }
19 | *
20 | * @version 2017-12-17
21 | * @author EXP: 272629724@qq.com
22 | * @since jdk版本:jdk1.6
23 | */
24 | public class RoomBlock extends _Msg {
25 |
26 | private int roomId;
27 |
28 | private String uid;
29 |
30 | private String uname;
31 |
32 | public RoomBlock(JSONObject json) {
33 | super(json);
34 | this.cmd = BiliCmd.ROOM_BLOCK_MSG;
35 | }
36 |
37 | @Override
38 | protected void analyse(JSONObject json) {
39 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
40 | this.uid = JsonUtils.getStr(json, BiliCmdAtrbt.uid);
41 | this.uname = JsonUtils.getStr(json, BiliCmdAtrbt.uname);
42 | }
43 |
44 | public int getRoomId() {
45 | return roomId;
46 | }
47 |
48 | public String getUid() {
49 | return uid;
50 | }
51 |
52 | public String getUname() {
53 | return uname;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RoomRank.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 直播间小时榜排名通知消息:
13 | {
14 | "cmd": "ROOM_RANK",
15 | "data": {
16 | "roomid": 280446,
17 | "rank_desc": "小时榜 12",
18 | "color": "#FB7299",
19 | "h5_url": "https://live.bilibili.com/p/eden/rank-h5-current?anchor_uid=8192168",
20 | "web_url": "https://live.bilibili.com/blackboard/room-current-rank.html",
21 | "timestamp": 1529549460
22 | }
23 | }
24 | *
25 | * @version 2017-12-17
26 | * @author EXP: 272629724@qq.com
27 | * @since jdk版本:jdk1.6
28 | */
29 | public class RoomRank extends _Msg {
30 |
31 | private int roomId;
32 |
33 | private String rankDesc;
34 |
35 | public RoomRank(JSONObject json) {
36 | super(json);
37 | this.cmd = BiliCmd.ROOM_RANK;
38 | }
39 |
40 | @Override
41 | protected void analyse(JSONObject json) {
42 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
43 | this.roomId = JsonUtils.getInt(data, BiliCmdAtrbt.roomid, 0);
44 | this.rankDesc = JsonUtils.getStr(data, BiliCmdAtrbt.rank_desc);
45 | }
46 | }
47 |
48 | public int getRoomId() {
49 | return roomId;
50 | }
51 |
52 | public String getRankDesc() {
53 | return rankDesc;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RoomRealTimeMessageUpdate.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import exp.bilibili.protocol.envm.BiliCmd;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 | import net.sf.json.JSONObject;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 直播间实时信息更新(粉丝人数):
13 | {
14 | "cmd": "ROOM_REAL_TIME_MESSAGE_UPDATE",
15 | "data": {
16 | "roomid": 5440,
17 | "fans": 1211519,
18 | "red_notice": -1
19 | }
20 | }
21 | *
22 | * @version 2017-12-17
23 | * @author EXP: 272629724@qq.com
24 | * @since jdk版本:jdk1.6
25 | */
26 | public class RoomRealTimeMessageUpdate extends _Msg {
27 |
28 | private int roomId;
29 |
30 | private int fans;
31 |
32 | public RoomRealTimeMessageUpdate(JSONObject json) {
33 | super(json);
34 | this.cmd = BiliCmd.ROOM_REAL_TIME_MESSAGE_UPDATE;
35 | }
36 |
37 | @Override
38 | protected void analyse(JSONObject json) {
39 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
40 | this.roomId = JsonUtils.getInt(data, BiliCmdAtrbt.roomid, 0);
41 | this.fans = JsonUtils.getInt(data, BiliCmdAtrbt.fans, 0);
42 | }
43 | }
44 |
45 | public int getRoomId() {
46 | return roomId;
47 | }
48 |
49 | public int getFans() {
50 | return fans;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/RoomSilentOff.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 关播通知
13 | {
14 | "cmd": "ROOM_SILENT_OFF",
15 | "data": [
16 |
17 | ],
18 | "roomid": "269706"
19 | }
20 | *
21 | * @version 2017-12-17
22 | * @author EXP: 272629724@qq.com
23 | * @since jdk版本:jdk1.6
24 | */
25 | public class RoomSilentOff extends _Msg {
26 |
27 | private String roomId;
28 |
29 | public RoomSilentOff(JSONObject json) {
30 | super(json);
31 | this.cmd = BiliCmd.ROOM_SILENT_OFF;
32 | }
33 |
34 | @Override
35 | protected void analyse(JSONObject json) {
36 | this.roomId = JsonUtils.getStr(json, BiliCmdAtrbt.roomid);
37 | }
38 |
39 | public String getRoomId() {
40 | return roomId;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/SpecialGift.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import java.util.Iterator;
4 |
5 | import net.sf.json.JSONObject;
6 | import exp.bilibili.protocol.envm.BiliCmd;
7 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
8 | import exp.libs.utils.format.JsonUtils;
9 |
10 | /**
11 | *
12 | *
13 | *
14 | 特殊礼物:(房间内)节奏风暴消息
15 | {
16 | "cmd": "SPECIAL_GIFT",
17 | "data": {
18 | "39": {
19 | "id": 152125,
20 | "time": 90,
21 | "hadJoin": 0,
22 | "num": 1,
23 | "content": "皈依小乔~钵钵鸡~藤藤菜~啦啦啦",
24 | "action": "start"
25 | }
26 | }
27 | }
28 | *
29 | * @version 2017-12-17
30 | * @author EXP: 272629724@qq.com
31 | * @since jdk版本:jdk1.6
32 | */
33 | public class SpecialGift extends _Msg {
34 |
35 | private String raffleId;
36 |
37 | public SpecialGift(JSONObject json) {
38 | super(json);
39 | this.cmd = BiliCmd.SPECIAL_GIFT;
40 | }
41 |
42 | @SuppressWarnings("rawtypes")
43 | @Override
44 | protected void analyse(JSONObject json) {
45 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data);
46 | Iterator keys = data.keys();
47 | if(keys.hasNext()) {
48 | JSONObject obj = JsonUtils.getObject(data, keys.next().toString());
49 | this.raffleId = JsonUtils.getStr(obj, BiliCmdAtrbt.id);
50 | }
51 | }
52 |
53 | public String getRaffleId() {
54 | return raffleId;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/SysGift.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 高能礼物公告
13 | {
14 | "cmd": "SYS_GIFT",
15 | "msg": "茕茕茕茕孑立丶:? 在裕刺Fy的:?直播间447:?内赠送:?105:?共367个",
16 | "rnd": "0",
17 | "uid": 8277884,
18 | "msg_text": "茕茕茕茕孑立丶在裕刺Fy的直播间447内赠送火力票共367个"
19 | }
20 | *
21 | * @version 2017-12-17
22 | * @author EXP: 272629724@qq.com
23 | * @since jdk版本:jdk1.6
24 | */
25 | public class SysGift extends _Msg {
26 |
27 | protected String msg;
28 |
29 | protected String msgText;
30 |
31 | private String rnd;
32 |
33 | private String uid;
34 |
35 | public SysGift(JSONObject json) {
36 | super(json);
37 | this.cmd = BiliCmd.SYS_GIFT;
38 | }
39 |
40 | @Override
41 | protected void analyse(JSONObject json) {
42 | this.msg = JsonUtils.getStr(json, BiliCmdAtrbt.msg);
43 | this.msgText = JsonUtils.getStr(json, BiliCmdAtrbt.msg_text);
44 | this.rnd = JsonUtils.getStr(json, BiliCmdAtrbt.rnd);
45 | this.uid = JsonUtils.getStr(json, BiliCmdAtrbt.uid);
46 | }
47 |
48 | public String getMsg() {
49 | return msg;
50 | }
51 |
52 | public String getMsgText() {
53 | return msgText;
54 | }
55 |
56 | public String getRnd() {
57 | return rnd;
58 | }
59 |
60 | public String getUid() {
61 | return uid;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/SysMsg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 系统公告
13 | {
14 | "cmd": "SYS_MSG",
15 | "msg": "\u7cfb\u7edf\u516c\u544a\uff1a\u76f4\u64ad2017\u5e74\u5ea6\u56de\u9988\uff0c\u505a\u4efb\u52a1\u9886\u5956\u52b1\uff01",
16 | "rep": 1,
17 | "url": "https:\/\/live.bilibili.com\/pages\/1703\/2017livethx.html"
18 | }
19 | *
20 | * @version 2017-12-17
21 | * @author EXP: 272629724@qq.com
22 | * @since jdk版本:jdk1.6
23 | */
24 | public class SysMsg extends _Msg {
25 |
26 | protected String msg;
27 |
28 | protected String rep;
29 |
30 | protected String url;
31 |
32 | public SysMsg(JSONObject json) {
33 | super(json);
34 | this.cmd = BiliCmd.SYS_MSG;
35 | }
36 |
37 | @Override
38 | protected void analyse(JSONObject json) {
39 | this.msg = JsonUtils.getStr(json, BiliCmdAtrbt.msg);
40 | this.rep = JsonUtils.getStr(json, BiliCmdAtrbt.rep);
41 | this.url = JsonUtils.getStr(json, BiliCmdAtrbt.url);
42 | }
43 |
44 | public String getMsg() {
45 | return msg;
46 | }
47 |
48 | public String getRep() {
49 | return rep;
50 | }
51 |
52 | public String getUrl() {
53 | return url;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/TvEnd.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | 小电视中奖消息:
11 | {
12 | "cmd": "TV_END",
13 | "data": {
14 | "id": "165740",
15 | "uname": "仇家太多不愿意透露姓名的某楠",
16 | "sname": "镜虚名",
17 | "giftName": "100000x银瓜子",
18 | "mobileTips": "恭喜 仇家太多不愿意透露姓名的某楠 获得100000x银瓜子",
19 | "raffleId": "165740",
20 | "type": "small_tv",
21 | "from": "镜虚名",
22 | "fromFace": "http:\/\/i1.hdslb.com\/bfs\/face\/0bd90719b3fd27739c698db7ff24d500630c7685.jpg",
23 | "fromGiftId": 25,
24 | "win": {
25 | "uname": "仇家太多不愿意透露姓名的某楠",
26 | "face": "http:\/\/i0.hdslb.com\/bfs\/face\/1fbe1886241d26f2c55a2630ad644fe6a090ec06.jpg",
27 | "giftName": "银瓜子",
28 | "giftId": "silver",
29 | "giftNum": 100000,
30 | "giftImage": "http:\/\/s1.hdslb.com\/bfs\/live\/00d768b444f1e1197312e57531325cde66bf0556.png",
31 | "msg": "恭喜 <%仇家太多不愿意透露姓名的某楠%> 获得大奖 <%100000x银瓜子%>, 感谢 <%镜虚名%> 的赠送"
32 | }
33 | }
34 | }
35 | *
36 | * @version 2017-12-17
37 | * @author EXP: 272629724@qq.com
38 | * @since jdk版本:jdk1.6
39 | */
40 | public class TvEnd extends _Msg {
41 |
42 | public TvEnd(JSONObject json) {
43 | super(json);
44 | this.cmd = BiliCmd.TV_END;
45 | }
46 |
47 | @Override
48 | protected void analyse(JSONObject json) {
49 | // Undo
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/TvLottery.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 |
7 | /**
8 | *
9 | *
10 | *
11 | 小电视抽奖:
12 | {
13 | "cmd": "SYS_MSG",
14 | "msg": "叶娃娃没有名字:? 送给:? PASSさん:? 1个小电视飞船,点击前往TA的房间去抽奖吧",
15 | "msg_text": "叶娃娃没有名字:? 送给:? PASSさん:? 1个小电视飞船,点击前往TA的房间去抽奖吧",
16 | "msg_common": "全区广播:<%叶娃娃没有名字%> 送给<% PASSさん%> 1个小电视飞船,点击前往TA的房间去抽奖吧",
17 | "msg_self": "全区广播:<%叶娃娃没有名字%> 送给<% PASSさん%> 1个小电视飞船,快来抽奖吧",
18 | "rep": 1,
19 | "styleType": 2,
20 | "url": "http:\/\/live.bilibili.com\/2265100",
21 | "roomid": 2265100,
22 | "real_roomid": 2265100,
23 | "rnd": 0,
24 | "broadcast_type": 0
25 | }
26 | *
27 | * @version 2017-12-17
28 | * @author EXP: 272629724@qq.com
29 | * @since jdk版本:jdk1.6
30 | */
31 | public class TvLottery extends SysMsg {
32 |
33 | private String styleType;
34 |
35 | private int roomId;
36 |
37 | private int realRoomId;
38 |
39 | private String rnd;
40 |
41 | private String tvId;
42 |
43 | private String url;
44 |
45 | public TvLottery(JSONObject json) {
46 | super(json);
47 | }
48 |
49 | public int ROOM_ID() {
50 | int id = getRealRoomId();
51 | return (id <= 0 ? getRoomId() : id);
52 | }
53 |
54 | @Override
55 | protected void analyse(JSONObject json) {
56 | super.analyse(json);
57 | this.msg = JsonUtils.getStr(json, BiliCmdAtrbt.msg_common);
58 | this.styleType = JsonUtils.getStr(json, BiliCmdAtrbt.styleType);
59 | this.roomId = JsonUtils.getInt(json, BiliCmdAtrbt.roomid, 0);
60 | this.realRoomId = JsonUtils.getInt(json, BiliCmdAtrbt.real_roomid, 0);
61 | this.rnd = JsonUtils.getStr(json, BiliCmdAtrbt.rnd);
62 | this.tvId = JsonUtils.getStr(json, BiliCmdAtrbt.tv_id);
63 | this.url = JsonUtils.getStr(json, BiliCmdAtrbt.url);
64 | }
65 |
66 | public String getStyleType() {
67 | return styleType;
68 | }
69 |
70 | public int getRoomId() {
71 | return roomId;
72 | }
73 |
74 | public int getRealRoomId() {
75 | return realRoomId;
76 | }
77 |
78 | public String getRnd() {
79 | return rnd;
80 | }
81 |
82 | public String getTvId() {
83 | return tvId;
84 | }
85 |
86 | public String getUrl() {
87 | return url;
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/WelcomeGuard.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.plugin.envm.GuardType;
5 | import exp.bilibili.protocol.envm.BiliCmd;
6 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
7 | import exp.libs.utils.format.JsonUtils;
8 |
9 | /**
10 | *
11 | *
12 | *
13 | 提督/总督进入直播间欢迎消息:
14 | {
15 | "cmd": "WELCOME_GUARD",
16 | "data": {
17 | "uid": 1650868,
18 | "username": "M-亚絲娜",
19 | "guard_level": "2"
20 | }
21 | }
22 | *
23 | * @version 2017-12-17
24 | * @author EXP: 272629724@qq.com
25 | * @since jdk版本:jdk1.6
26 | */
27 | public class WelcomeGuard extends _Msg {
28 |
29 | protected String uid;
30 |
31 | protected String username;
32 |
33 | protected GuardType guardType;
34 |
35 | public WelcomeGuard(JSONObject json) {
36 | super(json);
37 | this.cmd = BiliCmd.WELCOME_GUARD;
38 | }
39 |
40 | @Override
41 | protected void analyse(JSONObject json) {
42 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
43 | this.uid = JsonUtils.getStr(data, BiliCmdAtrbt.uid);
44 | this.username = JsonUtils.getStr(data, BiliCmdAtrbt.username);
45 | int guardLevel = JsonUtils.getInt(data, BiliCmdAtrbt.guard_level, 0);
46 | this.guardType = GuardType.toGuardType(guardLevel);
47 | }
48 | }
49 |
50 | public String getUid() {
51 | return uid;
52 | }
53 |
54 | public String getUsername() {
55 | return username;
56 | }
57 |
58 | public GuardType getGuardType() {
59 | return guardType;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/WelcomeMsg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 |
8 | /**
9 | *
10 | *
11 | *
12 | 管理员/老爷进入直播间欢迎消息:
13 | {
14 | "cmd": "WELCOME",
15 | "data": {
16 | "uid": 210940623,
17 | "uname": "\u4e1d\u4e1d-",
18 | "isadmin": 0,
19 | "svip": 1 // 年费 (年费和月费只会出现一个)
20 | "vip":1 // 月费(年费和月费只会出现一个)
21 | },
22 | "roomid": 269706
23 | }
24 |
25 | {
26 | "cmd": "WELCOME",
27 | "data": {
28 | "uid": 56395161,
29 | "uname": "肉圆滚滚艹",
30 | "is_admin": false,
31 | "svip": 1
32 | "vip":1 // 月费(年费和月费只会出现一个)
33 | }
34 | }
35 | *
36 | * @version 2017-12-17
37 | * @author EXP: 272629724@qq.com
38 | * @since jdk版本:jdk1.6
39 | */
40 | public class WelcomeMsg extends _Msg {
41 |
42 | private final static String[] VIPS = {
43 | "老爷", "月费老爷", "年费老爷", "房管",
44 | };
45 |
46 | private String uid;
47 |
48 | private String username;
49 |
50 | private boolean isAdmin;
51 |
52 | private int vipLevel;
53 |
54 | private String vipDesc;
55 |
56 | public WelcomeMsg(JSONObject json) {
57 | super(json);
58 | this.cmd = BiliCmd.WELCOME;
59 | }
60 |
61 | @Override
62 | protected void analyse(JSONObject json) {
63 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data); {
64 | this.uid = JsonUtils.getStr(data, BiliCmdAtrbt.uid);
65 | this.username = JsonUtils.getStr(data, BiliCmdAtrbt.uname);
66 |
67 | this.isAdmin = JsonUtils.getBool(data, BiliCmdAtrbt.is_admin, false);
68 | if(isAdmin == false) {
69 | isAdmin = (JsonUtils.getInt(data, BiliCmdAtrbt.isadmin, 0) != 0);
70 | if(isAdmin == true) {
71 | vipLevel = 3; // 房管
72 | }
73 | } else {
74 | vipLevel = 3; // 房管
75 | }
76 |
77 | if(isAdmin == false) {
78 | vipLevel = JsonUtils.getInt(data, BiliCmdAtrbt.svip, 0);
79 | if(vipLevel > 0) {
80 | vipLevel = 2; // 年费
81 |
82 | } else {
83 | vipLevel = JsonUtils.getInt(data, BiliCmdAtrbt.vip, 0);
84 | }
85 | }
86 | this.vipDesc = VIPS[vipLevel];
87 | }
88 | }
89 |
90 | public String getUid() {
91 | return uid;
92 | }
93 |
94 | public String getUsername() {
95 | return username;
96 | }
97 |
98 | public int getVipLevel() {
99 | return vipLevel;
100 | }
101 |
102 | public String getVipDesc() {
103 | return vipDesc;
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/WishBottle.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | (直播间内)许愿瓶实现进度消息:
11 | {
12 | "cmd": "WISH_BOTTLE",
13 | "data": {
14 | "action": "update",
15 | "id": 2861,
16 | "wish": {
17 | "id": 2861,
18 | "uid": 20872515,
19 | "type": 1,
20 | "type_id": 4,
21 | "wish_limit": 100,
22 | "wish_progress": 7,
23 | "status": 1,
24 | "content": "唱青媚狐",
25 | "ctime": "2018-01-13 22:28:45",
26 | "count_map": [
27 | 1,
28 | 10,
29 | 100
30 | ]
31 | }
32 | }
33 | }
34 | *
35 | * @version 2017-12-17
36 | * @author EXP: 272629724@qq.com
37 | * @since jdk版本:jdk1.6
38 | */
39 | public class WishBottle extends _Msg {
40 |
41 | public WishBottle(JSONObject json) {
42 | super(json);
43 | this.cmd = BiliCmd.WISH_BOTTLE;
44 | }
45 |
46 | @Override
47 | protected void analyse(JSONObject json) {
48 | // Undo
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/ws/_Msg.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.ws;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmd;
5 |
6 | /**
7 | *
8 | * websocket接收的json消息基类
9 | *
10 | *
PROJECT : bilibili-plugin
11 | *
SUPPORT : www.exp-blog.com
12 | * @version 2018-01-31
13 | * @author EXP: 272629724@qq.com
14 | * @since jdk版本:jdk1.6
15 | */
16 | abstract class _Msg {
17 |
18 | protected BiliCmd cmd;
19 |
20 | protected JSONObject json;
21 |
22 | protected _Msg(JSONObject json) {
23 | this.cmd = BiliCmd.UNKNOW;
24 | this.json = (json == null ? new JSONObject() : json);
25 | analyse(this.json);
26 | }
27 |
28 | protected abstract void analyse(JSONObject json);
29 |
30 | public BiliCmd getCmd() {
31 | return cmd;
32 | }
33 |
34 | public JSONObject getJson() {
35 | return json;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/xhr/Achieve.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.xhr;
2 |
3 |
4 | /**
5 | *
6 | *
7 | * 普通成就对象:
8 | *
9 | {
10 | "code": 0,
11 | "msg": "OK",
12 | "data": {
13 | "user": {
14 | "achieve": 70,
15 | "progress": 7,
16 | "total": 48,
17 | "done": 3,
18 | "can_receive_normal": 1,
19 | "can_receive_legend": 0
20 | },
21 | "info": [
22 | {
23 | "tid": 30,
24 | "css": "task-30",
25 | "title": "挥金如土",
26 | "award": "银瓜子<\/i> × 15,000",
27 | "awards": [
28 | {
29 | "type": "silver",
30 | "num": "15000"
31 | }
32 | ],
33 | "achieve": 30,
34 | "descript": "达成条件:累计消费100,000瓜子",
35 | "status": true,
36 | "finished": false,
37 | "progress": {
38 | "now": 0,
39 | "max": 0
40 | }
41 | },
42 | {
43 | "tid": 5,
44 | "css": "task-5",
45 | "title": "脱非入欧",
46 | "award": "弹幕颜色:<\/i>红(需保持月费老爷状态)<\/p>",
47 | "awards": [
48 | {
49 | "type": "dannmakuColor",
50 | "color": "red",
51 | "text": "红(需保持月费老爷状态)"
52 | }
53 | ],
54 | "achieve": 50,
55 | "descript": "达成条件:成为月费老爷",
56 | "status": true,
57 | "finished": true,
58 | "progress": {
59 | "now": 0,
60 | "max": 0
61 | }
62 | },
63 | {
64 | "tid": 29,
65 | "css": "task-29",
66 | "title": "土豪潜质",
67 | "award": "银瓜子<\/i> × 1,000",
68 | "awards": [
69 | {
70 | "type": "silver",
71 | "num": "1000"
72 | }
73 | ],
74 | "achieve": 20,
75 | "descript": "达成条件:累计消费10,000瓜子",
76 | "status": true,
77 | "finished": true,
78 | "progress": {
79 | "now": 0,
80 | "max": 0
81 | }
82 | }
83 | ],
84 | "page": {
85 | "total": 3,
86 | "totalPage": 1,
87 | "current": "1",
88 | "info": [
89 |
90 | ],
91 | "pageSize": "100"
92 | }
93 | }
94 | }
95 | *
96 | *
PROJECT : bilibili-plugin
97 | *
SUPPORT : www.exp-blog.com
98 | * @version 2017-12-17
99 | * @author EXP: 272629724@qq.com
100 | * @since jdk版本:jdk1.6
101 | */
102 | public class Achieve {
103 |
104 | private String id;
105 |
106 | private String name;
107 |
108 | public Achieve(String id, String name) {
109 | this.id = (id == null ? "" : id);
110 | this.name = (name == null ? "" : name);
111 | }
112 |
113 | public String getId() {
114 | return id;
115 | }
116 |
117 | public String getName() {
118 | return name;
119 | }
120 |
121 | }
122 |
123 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/xhr/BagGift.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.xhr;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.plugin.envm.Gift;
5 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
6 | import exp.libs.utils.format.JsonUtils;
7 | import exp.libs.utils.other.StrUtils;
8 |
9 | /**
10 | *
11 | {
12 | "code": 0,
13 | "msg": "success",
14 | "message": "success",
15 | "data": {
16 | "list": [
17 | {
18 | "bag_id": 60039893,
19 | "gift_id": 1,
20 | "gift_name": "辣条",
21 | "gift_num": 1,
22 | "gift_type": 0,
23 | "expire_at": 1517328000
24 | },
25 | {
26 | "bag_id": 60032044,
27 | "gift_id": 1,
28 | "gift_name": "辣条",
29 | "gift_num": 6,
30 | "gift_type": 0,
31 | "expire_at": 1519747200
32 | },
33 | {
34 | "bag_id": 60044508,
35 | "gift_id": 1,
36 | "gift_name": "辣条",
37 | "gift_num": 2,
38 | "gift_type": 0,
39 | "expire_at": 1519833600
40 | }
41 | ],
42 | "time": 1517276975
43 | }
44 | }
45 | *
46 | */
47 | public class BagGift {
48 |
49 | private String bagId;
50 |
51 | private String giftId;
52 |
53 | private String giftName;
54 |
55 | private int giftNum;
56 |
57 | /** 有效期(<=0表示永久有效) */
58 | private long expire;
59 |
60 | /** 可增加亲密值 */
61 | private int intimacy;
62 |
63 | public BagGift(String giftId, String giftName, int giftNum) {
64 | this.bagId = "0";
65 | this.giftId = (giftId == null ? "" : giftId);
66 | this.giftName = (giftName == null ? "" : giftName);
67 | this.giftNum = (giftNum < 0 ? 0 : giftNum);
68 | this.expire = 0;
69 | this.intimacy = Gift.getIntimacy(this.giftId);
70 | }
71 |
72 | /**
73 | * {
74 | "bag_id": 60039893,
75 | "gift_id": 1,
76 | "gift_name": "辣条",
77 | "gift_num": 1,
78 | "gift_type": 0,
79 | "expire_at": 1517328000
80 | }
81 | * @param json
82 | */
83 | public BagGift(JSONObject json) {
84 | this("", "", 0);
85 |
86 | if(json != null) {
87 | this.bagId = JsonUtils.getStr(json, BiliCmdAtrbt.bag_id);
88 | this.giftId = JsonUtils.getStr(json, BiliCmdAtrbt.gift_id);
89 | this.giftName = JsonUtils.getStr(json, BiliCmdAtrbt.gift_name);
90 | this.giftNum = JsonUtils.getInt(json, BiliCmdAtrbt.gift_num, 0);
91 | this.expire = JsonUtils.getLong(json, BiliCmdAtrbt.expire_at, 0) * 1000;
92 | this.intimacy = Gift.getIntimacy(giftId);
93 | }
94 | }
95 |
96 | public String getBagId() {
97 | return bagId;
98 | }
99 |
100 | public String getGiftId() {
101 | return giftId;
102 | }
103 |
104 | public String getGiftName() {
105 | return giftName;
106 | }
107 |
108 | public int getGiftNum() {
109 | return giftNum;
110 | }
111 |
112 | public void setGiftNum(int giftNum) {
113 | this.giftNum = giftNum;
114 | }
115 |
116 | public long getExpire() {
117 | return expire;
118 | }
119 |
120 | public int getIntimacy() {
121 | return intimacy;
122 | }
123 |
124 | @Override
125 | public String toString() {
126 | return StrUtils.concat(getGiftName(), "x", getGiftNum());
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/bean/xhr/MathTask.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.bean.xhr;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
5 | import exp.libs.utils.format.JsonUtils;
6 |
7 | /**
8 | *
9 | * 小学数学日常任务
10 | *
11 | *
PROJECT : bilibili-plugin
12 | *
SUPPORT : www.exp-blog.com
13 | * @version 2017-12-17
14 | * @author EXP: 272629724@qq.com
15 | * @since jdk版本:jdk1.6
16 | */
17 | public class MathTask {
18 |
19 | public final static MathTask NULL = new MathTask(null);
20 |
21 | private final static int MAX_STEP = 9;
22 |
23 | /** 是否存在下一轮任务 */
24 | private boolean existNext;
25 |
26 | private long bgnTime;
27 |
28 | private long endTime;
29 |
30 | /** 当前任务轮数 */
31 | private int curRound;
32 |
33 | /** 最大任务轮数 */
34 | private int maxRound;
35 |
36 | /** 当前轮的执行阶段:3min/6min/9min */
37 | private int step;
38 |
39 | public MathTask(JSONObject json) {
40 | this.existNext = true;
41 | if(json != null) {
42 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data);
43 | this.bgnTime = JsonUtils.getLong(data, BiliCmdAtrbt.time_start, 0);
44 | this.endTime = JsonUtils.getLong(data, BiliCmdAtrbt.time_end, 0);
45 | this.curRound = JsonUtils.getInt(data, BiliCmdAtrbt.times, 0);
46 | this.maxRound = JsonUtils.getInt(data, BiliCmdAtrbt.max_times, 0);
47 | this.step = JsonUtils.getInt(data, BiliCmdAtrbt.minute, 0);
48 |
49 | } else {
50 | this.bgnTime = 0;
51 | this.endTime = 0;
52 | this.curRound = 0;
53 | this.maxRound = 0;
54 | this.step = MAX_STEP;
55 | }
56 | }
57 |
58 | public boolean existNext() {
59 | return existNext;
60 | }
61 |
62 | public void setExistNext(boolean exist) {
63 | this.existNext = exist;
64 | }
65 |
66 | public long getBgnTime() {
67 | return bgnTime;
68 | }
69 |
70 | public long getEndTime() {
71 | return endTime;
72 | }
73 |
74 | public int getCurRound() {
75 | return curRound;
76 | }
77 |
78 | public int getMaxRound() {
79 | return maxRound;
80 | }
81 |
82 | public int getStep() {
83 | return step;
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/envm/BiliBinary.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.envm;
2 |
3 | import net.sf.json.JSONObject;
4 | import exp.libs.utils.num.BODHUtils;
5 | import exp.libs.utils.other.StrUtils;
6 |
7 | /**
8 | *
9 | * 通过Fiddler抓包解析得到的B站WebSocket交互的Binary数据
10 | *
11 | * Fiddler抓包样例
12 | *
13 | 14:15:04:9179 WSSession199.WebSocket'WebSocket #199'
14 | MessageID: Client.924
15 | MessageType: Binary
16 | PayloadString: 00-00-00-1F-00-10-00-01-00-00-00-02-00-00-00-01-5B-6F-62-6A-65-63-74-20-4F-62-6A-65-63-74-5D
17 | Masking: 27-72-F5-28
18 |
19 | 14:15:04:9529 WSSession199.WebSocket'WebSocket #199'
20 | MessageID: Server.925
21 | MessageType: Binary
22 | PayloadString: 00-00-00-14-00-10-00-01-00-00-00-03-00-00-00-01-00-00-00-0B
23 | Masking:
24 |
25 | 14:47:20:8430 WSSession54.WebSocket'WebSocket #54'
26 | MessageID: Client.7
27 | MessageType: Close
28 | PayloadString: 03-E9
29 | Masking: AD-73-35-23
30 |
31 | *
32 | *
PROJECT : bilibili-plugin
33 | *
SUPPORT : www.exp-blog.com
34 | * @version 2017-12-17
35 | * @author EXP: 272629724@qq.com
36 | * @since jdk版本:jdk1.6
37 | */
38 | public class BiliBinary {
39 |
40 | /** 房间号长度 */
41 | private final static String LEN[] = {
42 | "0", "1", "2", "3",
43 | "4", "5", "6", "7",
44 | "8", "9", "A", "B",
45 | "C", "D", "E", "F"
46 | };
47 |
48 | /** 私有化构造函数 */
49 | private BiliBinary() {}
50 |
51 | /**
52 | * B站WebSocket建立会话时发送的链接数据.
53 | * 其中前32个字节(两个十六进制数为1个字节, 1个字节8位)是固定.
54 | * 第4个字节的低4位代表房间号的长度.
55 | * 第33个字节开始就是json请求报文,格式形如 {"uid":0,"roomid":51108,"protover":1}
56 | *
57 | * @param realRoomId 真实房间号(未签约主播和签约主播都有的房间号)
58 | * @return
59 | */
60 | public static String CLIENT_CONNECT(int realRoomId) {
61 | JSONObject json = new JSONObject();
62 | json.put(BiliCmdAtrbt.uid, 0);
63 | json.put(BiliCmdAtrbt.roomid, realRoomId);
64 | json.put(BiliCmdAtrbt.protover, 1);
65 | String hex = BODHUtils.toHex(json.toString().getBytes());
66 | String len = LEN[String.valueOf(realRoomId).length()];
67 | return StrUtils.concat("0000003", len, "001000010000000700000001", hex);
68 | }
69 |
70 | /** B站WebSocket保持会话时发送的心跳数据 */
71 | public final static String CLIENT_HB =
72 | "0000001F0010000100000002000000015B6F626A656374204F626A6563745D";
73 |
74 | /** B站客户端主动发送断开连接的数据 */
75 | public final static String CLIENT_CLOSE = "03E9";
76 |
77 | /** B站WebSocket返回的连接确认信息 */
78 | public final static String SERVER_CONN_CONFIRM =
79 | "00000010001000010000000800000001";
80 |
81 | /** B站WebSocket返回的心跳确认信息(末2个字节因为是变化值,此处已删除) */
82 | public final static String SERVER_HB_CONFIRM =
83 | "00000014001000010000000300000001"; // 已去掉末尾变化字节
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/xhr/LiveArea.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import net.sf.json.JSONArray;
7 | import net.sf.json.JSONObject;
8 | import exp.bilibili.plugin.Config;
9 | import exp.bilibili.plugin.envm.Area;
10 | import exp.bilibili.protocol.envm.BiliCmdAtrbt;
11 | import exp.libs.utils.format.JsonUtils;
12 | import exp.libs.utils.other.StrUtils;
13 | import exp.libs.warp.net.http.HttpURLUtils;
14 |
15 | /**
16 | *
17 | * 直播分区查询
18 | *
19 | *
PROJECT : bilibili-plugin
20 | *
SUPPORT : www.exp-blog.com
21 | * @version 2017-12-17
22 | * @author EXP: 272629724@qq.com
23 | * @since jdk版本:jdk1.6
24 | */
25 | public class LiveArea extends __XHR {
26 |
27 | /** 游戏区/手游区房间列表URL */
28 | private final static String AREA_URL = Config.getInstn().AREA_URL();
29 |
30 | /**
31 | * 获取每个直播分区的TOP1房间号
32 | * @return TOP1房间号列表
33 | */
34 | public static Map getAreaTopOnes() {
35 | Map roomIds = new HashMap();
36 | roomIds.put(Area.PC_GAME, getAreaTopOne(Area.PC_GAME));
37 | roomIds.put(Area.APP_GAME, getAreaTopOne(Area.APP_GAME));
38 | roomIds.put(Area.AMUSE, getAreaTopOne(Area.AMUSE));
39 | roomIds.put(Area.DRAW, getAreaTopOne(Area.DRAW));
40 | roomIds.put(Area.RADIO, getAreaTopOne(Area.RADIO));
41 | return roomIds;
42 | }
43 |
44 | /**
45 | * 获取分区top1房间号
46 | * @param Area true:手机平台(对应手游区); false:PC平台(对应游戏区)
47 | * @return top1房间号
48 | */
49 | private static int getAreaTopOne(Area area) {
50 | final String SUB_AREA_ID = "0"; // 子分区号(0表示所有子分区)
51 | final String URI = StrUtils.concat("/p/eden/area-tags?parentAreaId=",
52 | area.ID(), "&areaId=", SUB_AREA_ID, "&visit_id=", getVisitId());
53 | Map header = GET_HEADER("", URI);
54 | Map request = getRequest(area.ID(), SUB_AREA_ID);
55 | String response = HttpURLUtils.doGet(AREA_URL, header, request);
56 |
57 | int roomId = 0;
58 | try {
59 | JSONObject json = JSONObject.fromObject(response);
60 | int code = JsonUtils.getInt(json, BiliCmdAtrbt.code, -1);
61 | if(code == 0) {
62 | JSONObject data = JsonUtils.getObject(json, BiliCmdAtrbt.data);
63 | JSONArray list = JsonUtils.getArray(data, BiliCmdAtrbt.list);
64 | roomId = JsonUtils.getInt(list.getJSONObject(0), BiliCmdAtrbt.roomid, 0);
65 |
66 | } else {
67 | String reason = JsonUtils.getStr(json, BiliCmdAtrbt.msg);
68 | log.warn("获取 {} Top1 房间失败: {}", area.DESC(), reason);
69 | }
70 | } catch(Exception e) {
71 | log.error("获取 {} Top1 房间异常: {}", area.DESC(), response, e);
72 | }
73 | return roomId;
74 | }
75 |
76 | /**
77 | * 获取分区TOP1房间号的请求参数
78 | * @param pAreaId
79 | * @param areaId
80 | * @return
81 | */
82 | private static Map getRequest(String pAreaId, String areaId) {
83 | Map request = new HashMap();
84 | request.put(BiliCmdAtrbt.platform, "web");
85 | request.put(BiliCmdAtrbt.parent_area_id, pAreaId);
86 | request.put(BiliCmdAtrbt.cate_id, "0");
87 | request.put(BiliCmdAtrbt.area_id, areaId);
88 | request.put(BiliCmdAtrbt.sort_type, "online");
89 | request.put(BiliCmdAtrbt.page, "1"); // 取首页
90 | request.put(BiliCmdAtrbt.page_size, "1"); // 只取1个房间
91 | return request;
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/xhr/LotteryEnergy.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr;
2 |
3 | import java.util.Iterator;
4 | import java.util.List;
5 | import java.util.Set;
6 |
7 | import exp.bilibili.plugin.Config;
8 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
9 | import exp.bilibili.plugin.bean.ldm.Raffle;
10 | import exp.bilibili.plugin.cache.CookiesMgr;
11 | import exp.bilibili.plugin.envm.LotteryType;
12 | import exp.bilibili.plugin.utils.UIUtils;
13 | import exp.libs.utils.os.ThreadUtils;
14 | import exp.libs.utils.other.StrUtils;
15 |
16 | /**
17 | *
18 | * 高能礼物抽奖
19 | *
20 | *
PROJECT : bilibili-plugin
21 | *
SUPPORT : www.exp-blog.com
22 | * @version 2017-12-17
23 | * @author EXP: 272629724@qq.com
24 | * @since jdk版本:jdk1.6
25 | */
26 | public class LotteryEnergy extends _Lottery {
27 |
28 | /** 高能礼物取号URL */
29 | private final static String EG_CHECK_URL = Config.getInstn().EG_CHECK_URL();
30 |
31 | /** 高能礼物抽奖URL */
32 | private final static String EG_JOIN_URL = Config.getInstn().EG_JOIN_URL();
33 |
34 | /** 私有化构造函数 */
35 | protected LotteryEnergy() {}
36 |
37 | /**
38 | * 高能礼物抽奖
39 | * @param roomId
40 | * @return
41 | */
42 | public static void toLottery(int roomId) {
43 | final List raffles = getRaffle(EG_CHECK_URL, roomId, CookiesMgr.MAIN().toNVCookie());
44 | if(raffles.isEmpty()) {
45 | return;
46 | }
47 |
48 | new Thread() {
49 | public void run() {
50 | while(raffles.size() > 0) {
51 | long now = System.currentTimeMillis();
52 | Iterator its = raffles.iterator();
53 | while(its.hasNext()) {
54 | Raffle raffle = its.next();
55 | if(now >= raffle.getDotime()) {
56 | toLottery(roomId, raffle);
57 | its.remove();
58 | }
59 | ThreadUtils.tSleep(100);
60 | }
61 | ThreadUtils.tSleep(1000);
62 | }
63 | };
64 | }.start();
65 | }
66 |
67 | /**
68 | * 参加抽奖
69 | * @param roomId
70 | * @param raffle
71 | */
72 | private static void toLottery(int roomId, Raffle raffle) {
73 | int cnt = 0;
74 | Set cookies = CookiesMgr.ALL();
75 | for(BiliCookie cookie : cookies) {
76 | if(!cookie.allowLottery() || !cookie.isBindTel()) {
77 | continue; // 未绑定手机的账号无法参与高能抽奖
78 | }
79 |
80 | String reason = join(LotteryType.ENGERY, cookie, EG_JOIN_URL, roomId, raffle);
81 | if(StrUtils.isEmpty(reason)) {
82 | log.info("[{}] 参与直播间 [{}] 抽奖成功(高能礼物)", cookie.NICKNAME(), roomId);
83 | cookie.updateLotteryTime();
84 | cnt++;
85 |
86 | } else if(!reason.contains("已加入抽奖")) {
87 | log.info("[{}] 参与直播间 [{}] 抽奖失败(小电视/摩天楼/活动) : {}", cookie.NICKNAME(), roomId, reason);
88 | UIUtils.statistics("失败(", reason, "): 直播间 [", roomId, "],账号[", cookie.NICKNAME(), "]");
89 |
90 | if(reason.contains("访问被拒绝")) {
91 | cookie.freeze();
92 | }
93 |
94 | // 高能已过期, 其他账号无需参与
95 | if(reason.contains("已过期") || reason.contains("不存在")) {
96 | break;
97 | }
98 | }
99 |
100 | ThreadUtils.tSleep(200);
101 | }
102 |
103 | if(cnt > 0) {
104 | UIUtils.statistics("成功(高能x", cnt, "): 直播间 [", roomId, "]");
105 | UIUtils.updateLotteryCnt(cnt);
106 | }
107 | }
108 |
109 | }
110 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/protocol/xhr/LotteryTV.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr;
2 |
3 | import java.util.Iterator;
4 | import java.util.List;
5 | import java.util.Set;
6 |
7 | import exp.bilibili.plugin.Config;
8 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
9 | import exp.bilibili.plugin.bean.ldm.Raffle;
10 | import exp.bilibili.plugin.cache.CookiesMgr;
11 | import exp.bilibili.plugin.envm.LotteryType;
12 | import exp.bilibili.plugin.utils.UIUtils;
13 | import exp.libs.utils.os.ThreadUtils;
14 | import exp.libs.utils.other.StrUtils;
15 |
16 | /**
17 | *
18 | * 小电视抽奖
19 | *
20 | *
PROJECT : bilibili-plugin
21 | *
SUPPORT : www.exp-blog.com
22 | * @version 2017-12-17
23 | * @author EXP: 272629724@qq.com
24 | * @since jdk版本:jdk1.6
25 | */
26 | public class LotteryTV extends _Lottery {
27 |
28 | /** 小电视取号URL */
29 | private final static String TV_CHECK_URL = Config.getInstn().TV_CHECK_URL();
30 |
31 | /** 小电视抽奖URL */
32 | private final static String TV_JOIN_URL = Config.getInstn().TV_JOIN_URL();
33 |
34 | /** 私有化构造函数 */
35 | protected LotteryTV() {}
36 |
37 | /**
38 | * 小电视抽奖
39 | * @param roomId
40 | * @return
41 | */
42 | public static void toLottery(int roomId) {
43 | final List raffles = getRaffle(TV_CHECK_URL, roomId, CookiesMgr.MAIN().toNVCookie());
44 | if(raffles.isEmpty()) {
45 | return;
46 | }
47 |
48 | new Thread() {
49 | public void run() {
50 | while(raffles.size() > 0) {
51 | long now = System.currentTimeMillis();
52 | Iterator its = raffles.iterator();
53 | while(its.hasNext()) {
54 | Raffle raffle = its.next();
55 | if(now >= raffle.getDotime()) {
56 | toLottery(roomId, raffle);
57 | its.remove();
58 | }
59 | ThreadUtils.tSleep(100);
60 | }
61 | ThreadUtils.tSleep(1000);
62 | }
63 | };
64 | }.start();
65 | }
66 |
67 | /**
68 | * 参加小电视抽奖
69 | * @param roomId
70 | * @param raffle
71 | * @return
72 | */
73 | public static void toLottery(int roomId, Raffle raffle) {
74 | int cnt = 0;
75 | Set cookies = CookiesMgr.ALL();
76 | for(BiliCookie cookie : cookies) {
77 | if(cookie.allowLottery() == false) {
78 | continue;
79 | }
80 |
81 | String reason = join(LotteryType.TV, cookie, TV_JOIN_URL, roomId, raffle);
82 | if(StrUtils.isEmpty(reason)) {
83 | log.info("[{}] 参与直播间 [{}] 抽奖成功(小电视/摩天楼/活动)", cookie.NICKNAME(), roomId);
84 | cookie.updateLotteryTime();
85 | cnt++;
86 |
87 | } else {
88 | log.info("[{}] 参与直播间 [{}] 抽奖失败(小电视/摩天楼/活动) : {}", cookie.NICKNAME(), roomId, reason);
89 | UIUtils.statistics("失败(", reason, "): 直播间 [", roomId, "],账号[", cookie.NICKNAME(), "]");
90 |
91 | if(reason.contains("访问被拒绝")) {
92 | cookie.freeze();
93 | }
94 |
95 | // 小电视已过期, 其他账号无需参与
96 | if(reason.contains("已过期") || reason.contains("不存在")) {
97 | break;
98 | }
99 | }
100 |
101 | ThreadUtils.tSleep(200);
102 | }
103 |
104 | if(cnt > 0) {
105 | UIUtils.statistics("成功(小电视/摩天楼/活动x", cnt, "): 直播间 [", roomId, "]");
106 | UIUtils.updateLotteryCnt(cnt);
107 | }
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/src/main/java/exp/bilibili/robot/ChatRobot.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.robot;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import net.sf.json.JSONObject;
7 | import exp.bilibili.plugin.Config;
8 | import exp.libs.envm.HttpHead;
9 | import exp.libs.utils.format.JsonUtils;
10 | import exp.libs.warp.net.http.HttpURLUtils;
11 |
12 | /**
13 | *
14 | * 图灵AI聊天机器人
15 | *
16 | *
PROJECT : bilibili-plugin
17 | *
SUPPORT : www.exp-blog.com
18 | * @version 2017-12-17
19 | * @author EXP: 272629724@qq.com
20 | * @since jdk版本:jdk1.6
21 | */
22 | public class ChatRobot {
23 |
24 | private final static String CHAT_SERVER = Config.getInstn().CHAT_SERVER();
25 |
26 | private final static String CHAT_KEY = Config.getInstn().CHAT_KEY();
27 |
28 | public static String send(String msg) {
29 | Map header = getHeader();
30 | Map request = getRequest(msg);
31 | String json = HttpURLUtils.doPost(CHAT_SERVER, header, request);
32 |
33 | String response = "";
34 | try {
35 | response = JsonUtils.getStr(JSONObject.fromObject(json), "text");
36 | } catch(Exception e) {}
37 | return response;
38 | }
39 |
40 | private static Map getHeader() {
41 | Map header = new HashMap();
42 | header.put(HttpHead.KEY.ACCEPT, "application/json, text/javascript, */*; q=0.01");
43 | header.put(HttpHead.KEY.ACCEPT_ENCODING, "gzip, deflate");
44 | header.put(HttpHead.KEY.ACCEPT_LANGUAGE, "zh-CN,zh;q=0.9,en;q=0.8");
45 | header.put(HttpHead.KEY.HOST, "www.tuling123.com");
46 | header.put(HttpHead.KEY.USER_AGENT, HttpHead.VAL.USER_AGENT);
47 | return header;
48 | }
49 |
50 | private static Map getRequest(String msg) {
51 | Map request = new HashMap();
52 | request.put("key", CHAT_KEY);
53 | request.put("info", msg);
54 | return request;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/resources/.verinfo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/main/resources/.verinfo
--------------------------------------------------------------------------------
/src/main/resources/exp/bilibili/plugin/bean/pdm/BP-DB.sql:
--------------------------------------------------------------------------------
1 |
2 | CREATE TABLE IF NOT EXISTS T_ACTIVITY (
3 | I_PERIOD INTEGER NULL,
4 | S_UID TEXT(32) NULL,
5 | S_USERNAME TEXT(64) NULL,
6 | I_COST INTEGER NULL,
7 | I_ROOMID INTEGER NULL
8 | );
9 |
10 |
--------------------------------------------------------------------------------
/src/main/resources/exp/bilibili/plugin/ui/login/cookie.tpl:
--------------------------------------------------------------------------------
1 | DedeUserID=@{DedeUserID}@ ; Domain=.bilibili.com ; Path=/ ; Expires=@{Expires}@ ;
2 | DedeUserID__ckMd5=@{DedeUserID__ckMd5}@ ; Domain=.bilibili.com ; Path=/ ; Expires=@{Expires}@ ;
3 | SESSDATA=@{SESSDATA}@ ; Domain=.bilibili.com ; Path=/ ; Expires=@{Expires}@ ; HttpOnly ;
4 | bili_jct=@{bili_jct}@ ; Domain=.bilibili.com ; Path=/ ; Expires=@{Expires}@ ;
--------------------------------------------------------------------------------
/src/main/resources/exp/bilibili/plugin/ui/login/eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/main/resources/exp/bilibili/plugin/ui/login/eye.png
--------------------------------------------------------------------------------
/src/main/resources/exp/bilibili/plugin/ui/login/reflash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/main/resources/exp/bilibili/plugin/ui/login/reflash.png
--------------------------------------------------------------------------------
/src/main/resources/exp/bilibili/protocol/xhr/visit_id.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 节奏风暴的入参visit_id的生成算法.
3 | * @returns 只含有 [0-9a-z] 的长度为12的随机字符串
4 | */
5 | function get_visit_id() {
6 | // (new Date).getTime() 为当前时间的毫秒值,如: 1526140830824
7 | // Math.ceil(x) 表示对浮点数x向上取整, 即返回大于参数x的最小整数
8 | // Math.random() 返回0.0 ~ 1.0 之间的一个伪随机数, 如: 0.7033043201427198
9 | // toString(36) 表示生成36进制字符串, 亦即只含有 [0-9a-z] 的字符串
10 | return ((new Date).getTime() * Math.ceil(1e6 * Math.random())).toString(36)
11 | }
--------------------------------------------------------------------------------
/src/main/resources/exp/libs/warp/ui/cpt/win/tray.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/main/resources/exp/libs/warp/ui/cpt/win/tray.png
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/certificate/test/GenerateCertificate.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.certificate.test;
2 |
3 | import exp.bilibili.plugin.utils.SafetyUtils;
4 | import exp.bilibili.plugin.utils.TimeUtils;
5 | import exp.libs.utils.encode.CryptoUtils;
6 | import exp.libs.utils.num.NumUtils;
7 |
8 | /**
9 | *
10 | * 生成授权信息
11 | *
12 | *
PROJECT : bilibili-plugin
13 | *
SUPPORT : www.exp-blog.com
14 | * @version 2017-12-17
15 | * @author EXP: 272629724@qq.com
16 | * @since jdk版本:jdk1.6
17 | */
18 | public class GenerateCertificate {
19 |
20 | public static void main(String[] args) {
21 | updatePrivateTime();
22 | }
23 |
24 | /**
25 | * 更新对私授权时间
26 | * 对私时间用于对外出售,限制其使用期限(过期后不管对公时间如何,均无法启动)
27 | */
28 | public static void updatePrivateTime() {
29 | int day = 30; // 授权时间(从当前开始往后推N天)
30 | String code = SafetyUtils.certificateToFile(day); // 授权码
31 | System.out.println(code);
32 | System.out.println(TimeUtils.toStr(NumUtils.toLong(CryptoUtils.deDES(code))));
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/plugin/bean/test/CreateBeans.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.bean.test;
2 |
3 | import java.sql.Connection;
4 |
5 | import exp.bilibili.plugin.cache.ActivityMgr;
6 | import exp.libs.warp.db.sql.SqliteUtils;
7 |
8 | public class CreateBeans {
9 |
10 | public static void main(String[] args) {
11 | Connection conn = SqliteUtils.getConn(ActivityMgr.DS);
12 | SqliteUtils.createBeanFromDB(conn,
13 | "exp.bilibili.plugin.bean.ldm",
14 | "./src/main/java/exp/bilibili/plugin/bean/ldm",
15 | new String[] { "T_ACTIVITY" }
16 | );
17 | SqliteUtils.close(conn);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/plugin/cache/test/ShowCookies.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.cache.test;
2 |
3 | import java.util.Set;
4 |
5 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
6 | import exp.bilibili.plugin.cache.CookiesMgr;
7 | import exp.bilibili.plugin.envm.CookieType;
8 |
9 | public class ShowCookies {
10 |
11 |
12 | public static void main(String[] args) {
13 | CookiesMgr.getInstn().load(CookieType.MAIN);
14 | CookiesMgr.getInstn().load(CookieType.VEST);
15 | CookiesMgr.getInstn().load(CookieType.MINI);
16 |
17 | System.out.println("================= MAIN-COOKIE =================");
18 | System.out.println(CookiesMgr.MAIN().toNVCookie());
19 | System.out.println(CookiesMgr.MAIN().toHeaderCookie());
20 |
21 | System.out.println("================= VEST-COOKIE =================");
22 | System.out.println(CookiesMgr.VEST().toNVCookie());
23 | System.out.println(CookiesMgr.VEST().toHeaderCookie());
24 |
25 | System.out.println("================= MINI-COOKIE =================");
26 | Set minis = CookiesMgr.MINIs();
27 | for(BiliCookie mini : minis) {
28 | System.out.println(mini.toNVCookie());
29 | System.out.println(mini.toHeaderCookie());
30 | System.out.println("--------");
31 | }
32 |
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/plugin/utils/test/TestImgRecognizeUtils.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils.test;
2 |
3 | import java.io.File;
4 |
5 | import exp.bilibili.plugin.cache.VercodeRecognition;
6 |
7 | public class TestImgRecognizeUtils {
8 |
9 | public static void main(String[] args) {
10 | File dir = new File("./src/test/resources/exp/bilibili/plugin/utils/test/math/cur");
11 | File[] files = dir.listFiles();
12 | for (File file : files) {
13 | if (file.isDirectory()) {
14 | continue;
15 | }
16 |
17 | // if (!file.getName().equals("img-1.jpeg")) {
18 | // continue;
19 | // }
20 |
21 | String imgPath = file.getAbsolutePath();
22 | String exp = VercodeRecognition.getInstn().analyse(imgPath);
23 | System.out.println(file.getName() + ":" + exp);
24 | System.out.println("=====");
25 | }
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/plugin/utils/test/TestVercodeUtils.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.plugin.utils.test;
2 |
3 | import java.io.File;
4 |
5 | import org.junit.Test;
6 |
7 | import exp.bilibili.plugin.utils.VercodeUtils;
8 | import exp.libs.envm.FileType;
9 | import exp.libs.utils.io.FileUtils;
10 |
11 | public class TestVercodeUtils {
12 |
13 | @Test
14 | public void testCalculateExpressionImage() {
15 | File dir = new File("./src/test/resources/exp/bilibili/plugin/utils/test/math/cur");
16 | File[] imgs = dir.listFiles();
17 | for(File img : imgs) {
18 | int rst = VercodeUtils.calculateImageExpression(img.getPath());
19 | System.out.println(img.getName() + " : " + rst);
20 | }
21 | }
22 |
23 | @Test
24 | public void testCalculateExpressionImageByOCR() {
25 | File dir = new File("./src/test/resources/exp/bilibili/plugin/utils/test/math/ocr");
26 | File[] imgs = dir.listFiles();
27 | for(File img : imgs) {
28 | int rst = VercodeUtils.calculateImageExpressionByOCR(img.getPath());
29 | System.out.println(img.getName() + " : " + rst);
30 | }
31 | }
32 |
33 | @Test
34 | public void testRecognizeStormImage() {
35 | File dir = new File("./src/test/resources/exp/bilibili/plugin/utils/test/storm/train");
36 | File[] imgs = dir.listFiles();
37 | for(File img : imgs) {
38 | FileType type = FileUtils.getFileType(img);
39 | if(type == FileType.PNG) {
40 | String code = VercodeUtils.recognizeStormImage(img.getPath());
41 | System.out.println(img.getName() + " : " + code);
42 | }
43 | }
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/test/TestGetServerConfig.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.test;
2 |
3 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
4 | import exp.bilibili.plugin.cache.CookiesMgr;
5 | import exp.bilibili.plugin.envm.CookieType;
6 | import exp.bilibili.protocol.xhr.Other;
7 |
8 | /**
9 | *
10 | * 测试提取当前B站的服务器配置信息
11 | *
12 | *
PROJECT : bilibili-plugin
13 | *
SUPPORT : www.exp-blog.com
14 | * @version 2017-12-17
15 | * @author EXP: 272629724@qq.com
16 | * @since jdk版本:jdk1.6
17 | */
18 | public class TestGetServerConfig {
19 |
20 | public static void main(String[] args) {
21 | CookiesMgr.getInstn().load(CookieType.MAIN);
22 | BiliCookie cookie = CookiesMgr.MAIN();
23 | String json = Other.queryServerConfig(cookie, 269706);
24 | System.out.println(json);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/test/TestWSAnalyser.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.test;
2 |
3 | import exp.bilibili.plugin.utils.ZlibUtils;
4 | import exp.libs.utils.num.BODHUtils;
5 | import exp.libs.utils.other.StrUtils;
6 |
7 | /**
8 | *
9 | * 测试WebSocket的接收报文
10 | *
11 | *
PROJECT : bilibili-plugin
12 | *
SUPPORT : www.exp-blog.com
13 | * @version 2017-12-17
14 | * @author EXP: 272629724@qq.com
15 | * @since jdk版本:jdk1.6
16 | */
17 | public class TestWSAnalyser {
18 |
19 | public static void main(String[] args) {
20 | String hex = "000004D600100002000000050000000078DAAC97CD4F1B4718C69D43A55E2AF54FA8DEF320CD3BDFEB4325834D54A5690F6DD4AA2E42365E2756C0A90A54AA50A49002718096444A9B800DA1126DBE28F94229189AFC31F5EEDA27CEBD55B3C6C621762071C05AEF6B7967767FF3CCF3BC8E444E7C19F93062FFDEB38709181AC94014E2B1CF4E9F193CFDC5492090CB672F403499A40409930495D69AA124281D2A854325A5A25171A6905002882E432128106AFF0708F89BCFBDE9396FEDBEB75BAE94678024B9B6170A24E0FFB5562997BD85FB5E71D55BBB57D99AF54B57F72F254829B553030C90A42010CCDDAC15EF02016FE3815F5A6F94926987284115E38200D839938C114AA4A1523B94C0B7E3947257DAE1EC5030961B1B767B908B1E04F25235104E9C1F1F1E261330360AD183472530340651E04C63A23F16878B075F0D0F74E0622472A2AF7BA6C81B9564CA58A65C3929C1E5D001D3EA8B457F763628DD0E96A6EA7CABBF5FAADD5BEF039244E4C220A7042AFF5CABECCE064B53DEC253FFEA5C27AEFEF24C75611E1A27FECD55FFD779204C51A9DF0C2C84631E8550C884EE8FF5B20E083FE81E21A3A68150491D22E4596499B43C2C4BF291FF68ABFAA2142C4D057FAC00490A6D1CAA085437B6FCC2F5DAADA7DE747B410E90245A184D406F0783F17E194F249CF6302213ED607C95F8B4EFF3D3092090498DA5203A01E3B90C44391A23D01018CFA7465C8882FFAC10DE3DE446075399915C1EA2D9D4F0A84B60F487DC7710A504C27724307261E8FCA09BCDBAF6A6E845BB0E9F74BF0EDCA1A40739324D9940FB7C9036326586943E5808AFB8E26DDCF4B60A40920E575C30E610F066D6BDE5CBC1E2F3DA95F9B6FC15016FED8EFFF0E7DAF63410486446C6F399F837E752F9B340A405DC94695DBAA85FB75AFB2E2068AB2784D5D16B287B85343AA63A08FACC1B82545272D64251C80343A0A19A59DA65546B6C5173E17A6567DDBFF5D09B59F5668A7BBB9396A6A254694DA0FAA854D9BAE4AFFE1D2C4DD5FE5CF4CBD7DA22452450DBF9C57F52A8159F40E3FC54CE1235C8B91204A944A6986CFA813C86D1BE1554D45461AFA3DF91D11E862A65A3D29AB3D02228539856FCB045E4D340928A29A12552FB6131B833D77C750459D95EF6D636ABC52B36B0962FFBA5756FE18655A6D2AF52A4AF95666AF47CCF8F6EEAFB2643E61C0BA1C34C22DEDBDBD70161AC4B848A8AFD4A097442849ABAEE906C41E83D9E0C6EDCB5998F8209632C98AD92FFDB76B0F9C05F7930D81E9F7E7DD8A3D29209D1C4C779384283697B151AD322C2B0381A603F8AB891BC83399FF8B87B8754CDBD6D1C1A1AA4CA3A5974E42B4955CF297F67B39E53C8B57278C87367B1522ED79657EA27ED89B223881E12E411448F176D719DE0C650D121DAFE7B07F484430C221574BFFBCCB80EA6986A81B7B77BDBA63A93DC5043C0092E6F33E315663A663A769FE9683021FA4D27EB3AD9EDBED394204344AE0C0F1BC44C46A59543E54B0DA2F7783A987A16BCD8098AB7EA7DB7E48E325671509BDEF64B857F2737BE6E2F1771E406140A153B66BBFDB6FEA56398E8D7A603C6F7BBC46858B34914CAC6186475369D36B4E5B74BB0F35375EE71AD38B5B73BEF97AE0637EEEEED4EFA93F7EAF92A38E74218EBF5974EE57367CF8D75521557ADFB49682ACC1BEC2316EB8DABBEB6EDC5FF010000FFFFB60FEE48";
21 | String str = new String(ZlibUtils.decompress(BODHUtils.toBytes(hex.substring(32))));
22 | String[] msgs = str.split("\0");
23 | for(String msg : msgs) {
24 | if(StrUtils.isNotTrimEmpty(msg) && msg.startsWith("{")) {
25 | System.out.println(msg);
26 | }
27 | }
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/test/TestXHRSender.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.test;
2 |
3 | import java.util.Set;
4 |
5 | import exp.bilibili.plugin.cache.CookiesMgr;
6 | import exp.bilibili.plugin.cache.RoomMgr;
7 | import exp.bilibili.plugin.envm.CookieType;
8 | import exp.bilibili.protocol.XHRSender;
9 | import exp.libs.utils.os.ThreadUtils;
10 |
11 | /**
12 | *
13 | * 测试XHR请求
14 | *
15 | *
PROJECT : bilibili-plugin
16 | *
SUPPORT : www.exp-blog.com
17 | * @version 2017-12-17
18 | * @author EXP: 272629724@qq.com
19 | * @since jdk版本:jdk1.6
20 | */
21 | public class TestXHRSender {
22 |
23 | public static void main(String[] args) {
24 | CookiesMgr.getInstn().load(CookieType.MAIN);
25 | CookiesMgr.getInstn().load(CookieType.VEST);
26 | CookiesMgr.getInstn().load(CookieType.MINI);
27 |
28 | testGetGuardGift();
29 | }
30 |
31 | /**
32 | * 测试补领所有房间的总督奖励
33 | */
34 | private static void testGetGuardGift() {
35 | Set roomIds = RoomMgr.getInstn().getRealRoomIds();
36 | for(Integer roomId : roomIds) {
37 | System.out.println(roomId);
38 | XHRSender.getGuardGift(roomId);
39 | ThreadUtils.tSleep(10);
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestChat.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.protocol.xhr.Chat;
6 | import exp.libs.envm.Colors;
7 |
8 | public class TestChat extends _Init {
9 |
10 | @Test
11 | public void testSendDanmu() {
12 | boolean isOk = Chat.sendDanmu(cookie, roomId, "Test Msg", Colors.GOLD);
13 | System.out.println(isOk);
14 | }
15 |
16 | @Test
17 | public void testSendPM() {
18 | // Undo
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestDailyTasks.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.plugin.utils.TimeUtils;
6 | import exp.bilibili.protocol.xhr.DailyTasks;
7 |
8 | public class TestDailyTasks extends _Init {
9 |
10 | @Test
11 | public void testToAssn() {
12 | long millis = DailyTasks.toAssn(cookie);
13 | System.out.println(TimeUtils.toStr(millis));
14 | }
15 |
16 | @Test
17 | public void testToSign() {
18 | long millis = DailyTasks.toSign(cookie);
19 | System.out.println(TimeUtils.toStr(millis));
20 | }
21 |
22 | @Test
23 | public void testReceiveDailyGift() {
24 | long millis = DailyTasks.receiveDailyGift(cookie);
25 | System.out.println(TimeUtils.toStr(millis));
26 | }
27 |
28 | @Test
29 | public void testReceiveHolidayGift() {
30 | long millis = DailyTasks.receiveHolidayGift(cookie);
31 | System.out.println(TimeUtils.toStr(millis));
32 | }
33 |
34 | @Test
35 | public void testOnlineHeartbeat() {
36 | long millis = DailyTasks.onlineHeartbeat(cookie);
37 | System.out.println(TimeUtils.toStr(millis));
38 | }
39 |
40 | @Test
41 | public void testDoMathTask() {
42 | long millis = DailyTasks.doMathTask(cookie);
43 | System.out.println(TimeUtils.toStr(millis));
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestGifts.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import java.util.Iterator;
4 | import java.util.List;
5 | import java.util.Map;
6 |
7 | import org.junit.Test;
8 |
9 | import exp.bilibili.protocol.bean.xhr.BagGift;
10 | import exp.bilibili.protocol.bean.xhr.Medal;
11 | import exp.bilibili.protocol.xhr.Gifts;
12 | import exp.libs.utils.other.StrUtils;
13 |
14 | public class TestGifts extends _Init {
15 |
16 | @Test
17 | public void testQueryBagList() {
18 | List bagGifts = Gifts.queryBagList(cookie, roomId);
19 | for(BagGift bagGift : bagGifts) {
20 | System.out.println(bagGift);
21 | }
22 | }
23 |
24 | @Test
25 | public void testQuerySilver() {
26 | int num = Gifts.querySilver(cookie);
27 | System.out.println(num);
28 | }
29 |
30 | @Test
31 | public void testFeed() {
32 | // Undo
33 | }
34 |
35 | @Test
36 | public void testQueryCapsuleCoin() {
37 | int num = Gifts.queryCapsuleCoin(cookie);
38 | System.out.println(num);
39 | }
40 |
41 | @Test
42 | public void testOpenCapsuleCoin() {
43 | boolean isOk = Gifts.openCapsuleCoin(cookie, 1);
44 | System.out.println(isOk);
45 | }
46 |
47 | @Test
48 | public void testQueryMedals() {
49 | Map map = Gifts.queryMedals(cookie);
50 | Iterator keys = map.keySet().iterator();
51 | while(keys.hasNext()) {
52 | Integer key = keys.next();
53 | Medal value = map.get(key);
54 | System.out.println(StrUtils.concat(key, " = ", value));
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestGuard.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import java.util.Iterator;
4 | import java.util.Map;
5 |
6 | import org.junit.Test;
7 |
8 | import exp.bilibili.plugin.envm.GuardType;
9 | import exp.bilibili.protocol.xhr.Guard;
10 | import exp.libs.utils.other.StrUtils;
11 |
12 | public class TestGuard extends _Init {
13 |
14 | @Test
15 | public void testCheckGuardIds() {
16 | Map map = Guard.checkGuardIds(cookie, roomId);
17 | Iterator keys = map.keySet().iterator();
18 | while(keys.hasNext()) {
19 | String key = keys.next();
20 | GuardType value = map.get(key);
21 | System.out.println(StrUtils.concat(key, " = ", value));
22 | }
23 | }
24 |
25 | @Test
26 | public void testGetGuardGiftInt() {
27 | int num = Guard.getGuardGift(roomId);
28 | System.out.println(num);
29 | }
30 |
31 | @Test
32 | public void testGetGuardGiftBiliCookieIntStringGuardType() {
33 | // Undo
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestLiveArea.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import java.util.Iterator;
4 | import java.util.Map;
5 |
6 | import org.junit.Test;
7 |
8 | import exp.bilibili.plugin.envm.Area;
9 | import exp.bilibili.protocol.xhr.LiveArea;
10 | import exp.libs.utils.other.StrUtils;
11 |
12 | public class TestLiveArea extends _Init {
13 |
14 | @Test
15 | public void testGetAreaTopOnes() {
16 | Map map = LiveArea.getAreaTopOnes();
17 | Iterator keys = map.keySet().iterator();
18 | while(keys.hasNext()) {
19 | Area key = keys.next();
20 | Integer value = map.get(key);
21 | System.out.println(StrUtils.concat(key, " = ", value));
22 | }
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestLogin.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.plugin.Config;
6 | import exp.bilibili.protocol.xhr.Login;
7 |
8 | public class TestLogin extends _Init {
9 |
10 | @Test
11 | public void testGetQrcodeInfo() {
12 | String rst = Login.getQrcodeInfo();
13 | System.out.println(rst);
14 | }
15 |
16 | @Test
17 | public void testDownloadVccode() {
18 | String imgPath = Config.getInstn().IMG_DIR().concat("/vccode.jpg");
19 | String cookie = Login.downloadVccode(imgPath);
20 | System.out.println(cookie);
21 | }
22 |
23 | @Test
24 | public void testToLoginString() {
25 | // Undo
26 | }
27 |
28 | @Test
29 | public void testToLoginStringStringStringString() {
30 | // Undo
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestLotteryEnergy.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.protocol.xhr.LotteryEnergy;
6 |
7 | public class TestLotteryEnergy extends _Init {
8 |
9 | @Test
10 | public void testToLottery() {
11 | LotteryEnergy.toLottery(roomId);
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestLotteryStorm.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import java.util.List;
4 |
5 | import org.junit.Test;
6 |
7 | import exp.bilibili.plugin.Config;
8 | import exp.bilibili.plugin.bean.ldm.HotLiveRange;
9 | import exp.bilibili.plugin.bean.ldm.Raffle;
10 | import exp.bilibili.protocol.xhr.LotteryStorm;
11 |
12 | public class TestLotteryStorm extends _Init {
13 |
14 | @Test
15 | public void testQueryHotLiveRoomIds() {
16 | HotLiveRange range = new HotLiveRange(1, 2);
17 | List roomIds = LotteryStorm.queryHotLiveRoomIds(range);
18 | System.out.println(roomIds);
19 | }
20 |
21 | @Test
22 | public void testToLotteryListOfIntegerLong() {
23 | HotLiveRange range = new HotLiveRange(1, 2);
24 | List hotRoomIds = LotteryStorm.queryHotLiveRoomIds(range);
25 | long scanInterval = Config.getInstn().STORM_FREQUENCY();
26 | LotteryStorm.toLottery(hotRoomIds, scanInterval);
27 | }
28 |
29 | @Test
30 | public void testToLotteryIntString() {
31 | Raffle raffle = new Raffle(); // FIXME
32 | LotteryStorm.toLottery(roomId, raffle);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestLotteryTV.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.plugin.bean.ldm.Raffle;
6 | import exp.bilibili.protocol.xhr.LotteryTV;
7 |
8 | public class TestLotteryTV extends _Init {
9 |
10 | @Test
11 | public void testToLotteryInt() {
12 | LotteryTV.toLottery(roomId);
13 | }
14 |
15 | @Test
16 | public void testToLotteryIntString() {
17 | Raffle raffle = new Raffle(); // FIXME
18 | LotteryTV.toLottery(roomId, raffle);
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestOther.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import java.util.List;
4 | import java.util.Set;
5 |
6 | import org.junit.Test;
7 |
8 | import exp.bilibili.protocol.bean.other.User;
9 | import exp.bilibili.protocol.bean.xhr.Achieve;
10 | import exp.bilibili.protocol.xhr.Other;
11 |
12 | public class TestOther extends _Init {
13 |
14 | @Test
15 | public void testQueryCertificateTags() {
16 | String rst = Other.queryCertificateTags();
17 | System.out.println(rst);
18 | }
19 |
20 | @Test
21 | public void testQueryServerConfig() {
22 | String rst = Other.queryServerConfig(cookie, roomId);
23 | System.out.println(rst);
24 | }
25 |
26 | @Test
27 | public void testQueryUserInfo() {
28 | User user = Other.queryUpInfo(roomId);
29 | System.out.println(user);
30 | }
31 |
32 | @Test
33 | public void testQueryUserSafeInfo() {
34 | System.out.println("[B] isBindTel:" + cookie.isBindTel());
35 | System.out.println("[B] isRealName:" + cookie.isRealName());
36 | Other.queryUserSafeInfo(cookie);
37 | System.out.println("[A] isBindTel:" + cookie.isBindTel());
38 | System.out.println("[A] isRealName:" + cookie.isRealName());
39 | }
40 |
41 | @Test
42 | public void testQueryUserAuthorityInfo() {
43 | System.out.println("[B] isRoomAdmin:" + cookie.isRoomAdmin());
44 | System.out.println("[B] isVip:" + cookie.isVip());
45 | System.out.println("[B] isSVip:" + cookie.isSVip());
46 | System.out.println("[B] isGuard:" + cookie.isGuard());
47 | Other.queryUserAuthorityInfo(cookie, roomId);
48 | System.out.println("[A] isRoomAdmin:" + cookie.isRoomAdmin());
49 | System.out.println("[A] isVip:" + cookie.isVip());
50 | System.out.println("[A] isSVip:" + cookie.isSVip());
51 | System.out.println("[A] isGuard:" + cookie.isGuard());
52 | }
53 |
54 | @Test
55 | public void testQueryUpInfo() {
56 | User user = Other.queryUpInfo(roomId);
57 | System.out.println(user);
58 | }
59 |
60 | @Test
61 | public void testQueryManagers() {
62 | Set users = Other.queryManagers(roomId);
63 | for(User user : users) {
64 | System.out.println(user);
65 | }
66 | }
67 |
68 | @Test
69 | public void testBlockUser() {
70 | // Undo
71 | }
72 |
73 | @Test
74 | public void testQueryAchieve() {
75 | List achieves = Other.queryAchieve(cookie);
76 | for(Achieve achieve : achieves) {
77 | System.out.println(achieve);
78 | }
79 | }
80 |
81 | @Test
82 | public void testDoAchieve() {
83 | // Undo
84 | }
85 |
86 | @Test
87 | public void testSearchRoomId() {
88 | String rst = Other.queryServerConfig(cookie, roomId);
89 | System.out.println(rst);
90 | }
91 |
92 | @Test
93 | public void testEntryRoomBiliCookieInt() {
94 | Other.entryRoom(cookie, roomId);
95 | }
96 |
97 | @Test
98 | public void testEntryRoomBiliCookieIntString() {
99 | // Undo
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/TestWatchLive.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Test;
4 |
5 | import exp.bilibili.protocol.xhr.WatchLive;
6 |
7 | public class TestWatchLive extends _Init {
8 |
9 | @Test
10 | public void testToWatchPCLive() {
11 | WatchLive.toWatchPCLive(cookie, roomId);
12 | }
13 |
14 | @Test
15 | public void testToWatchAppLive() {
16 | WatchLive.toWatchAppLive(cookie, roomId);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/test/java/exp/bilibili/protocol/xhr/test/_Init.java:
--------------------------------------------------------------------------------
1 | package exp.bilibili.protocol.xhr.test;
2 |
3 | import org.junit.Before;
4 |
5 | import exp.bilibili.plugin.bean.ldm.BiliCookie;
6 | import exp.bilibili.plugin.cache.CookiesMgr;
7 | import exp.bilibili.plugin.envm.CookieType;
8 |
9 | public class _Init {
10 |
11 | protected BiliCookie cookie;
12 |
13 | protected int roomId;
14 |
15 | @Before
16 | public void before() {
17 | System.setProperty("os.name", "Linux"); // 声明非 win 系统,避免测试弹窗
18 | CookiesMgr.getInstn().load(CookieType.MAIN);
19 | this.cookie = CookiesMgr.MAIN();
20 | this.roomId = 1;
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/12+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/12+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/13+8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/13+8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/14+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/14+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/17-6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/17-6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/18+2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/18+2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/18+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/18+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/20-7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/20-7.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/20-9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/20-9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/24+4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/24+4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/24+5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/24+5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/26-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/26-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/28+8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/28+8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/30+2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/30+2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/31+1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/31+1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/31+3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/31+3.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/32+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/32+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/40-3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/40-3.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/41+7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/41+7.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/41+9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/41+9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/43+7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/43+7.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/46+1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/46+1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/47+5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/47+5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/47-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/47-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/51-3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/51-3.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/55+1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/55+1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/55+2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/55+2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56+9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56+9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56-5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56-5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56-7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/56-7.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/57+5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/57+5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/58+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/58+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/58-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/58-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/60-2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/60-2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/61+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/61+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/63+6.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/63+6.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/64-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/64-1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/64-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/64-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/65+4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/65+4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/65-9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/65-9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/66+5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/66+5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67+1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67+1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67+9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67+9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67-7.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/67-7.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/70-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/70-1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/71-4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/71-4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/71-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/71-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/73-3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/73-3.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/77-8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/77-8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/78-4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/78-4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/79-3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/79-3.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/80-5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/80-5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/83-2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/83-2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/84-2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/84-2.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/84-5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/84-5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/85+4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/85+4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/95+5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/95+5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/96+8.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/96+8.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/97-9.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/97-9.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/98+4.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/98+4.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/98-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/98-1.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/99-5.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/cur/99-5.jpeg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/00.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/00.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/00.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/01.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/01.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/02.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/03.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/03.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/03.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/04.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/04.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/05.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/05.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/06.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/06.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/07.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/07.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/08.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/08.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/09.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/09.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/10.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/11.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/12.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/13.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/14.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/15.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/15.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/16.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/16.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/17.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/17.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/18.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/18.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/19.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/19.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/20.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/20.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/21.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/21.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/22.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/22.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/23.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/23.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/24.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/24.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/25.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/25.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/26.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/26.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/27.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/27.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/28.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/28.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/29.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/29.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/30.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/math/ocr/30.jpg
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839072.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839072.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839292.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839292.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839550.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839550.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839767.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839767.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839984.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096839984.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840182.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840182.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840383.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840383.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840741.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096840741.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096841050.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096841050.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096841305.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/download/1520096841305.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/1mcg2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/1mcg2.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/gyvs4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/gyvs4.png
--------------------------------------------------------------------------------
/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/kft77.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EXP-Codes/bilibili-plugin/d919b188f2179d6aed55db5cb2c97f97a6c1ab4c/src/test/resources/exp/bilibili/plugin/utils/test/storm/train/kft77.png
--------------------------------------------------------------------------------