当前位置:网站首页>虎牙自动发弹幕换牌子

虎牙自动发弹幕换牌子

2022-08-10 22:23:00 noobmantest

虎牙自动发弹幕换牌子

弹幕不受虎牙限制

温馨提示:需要电脑上安装Chrome浏览器
联系我:QQ2039808149 (欢迎讨论交流)

运行截图

在这里插入图片描述
运行流程:

  1. 输入主播房间号
  2. 输入想要发送的弹幕
  3. 进入同时切换牌子
  4. 点击开始发送弹幕,在弹幕框中随机选择一条弹幕发送。速度大概是1条/s。可设置发送不受虎牙限制
  5. 点击发送停止即可停止。

使用selenium模拟点击,物理脚本,比较可靠。缺点就是比较消耗电脑资源,多个账号同时登录比比较卡顿

部分代码:


@Slf4j
public class MainGUI {
    

    /* * * 管理员端的界面 */
    JFrame mainFrame = new JFrame();

    JTable userTable;
    Object[] usersTableTitle = {
    "编号", "标记", "是否可用", "cookie"};
    Object[][] users;

    // 主播和直播间信息
    ArrayList<String> anchorsMessage = new ArrayList<>();
    ArrayList<BarrageAndRoomNum> barrageAndRoomNumList = Init.barrageAndRoomNumList;

    JPanel rightContent, leftContent;
    JButton addUserButton, startSend, enterAnchorRoom, stopSend, safeStatus, safeUsers, delCurStatus, delUser;
    Box leftBox;
    JTextField anchorNum, delUserNum;
    JTextArea barrages;

    public JComboBox<String> changeAnchor;

    public MainGUI() {
    

        init();
        addListener();
        mainFrame.setVisible(true);
        mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 关闭窗口退出程序
        mainFrame.setBounds(500, 200, 700, 490);
        mainFrame.setTitle("管理员界面");

        updateUserInfo();
        updateAnchorAndMessage();
    }


    void init() {
    

        // 左侧菜单栏
        leftBox = Box.createVerticalBox();
        // 主播信息

        changeAnchor = new JComboBox(anchorsMessage.toArray());
        leftBox.add(changeAnchor);
        leftBox.add(Box.createVerticalStrut(30));

        addUserButton = new JButton("录入用户");
        addUserButton.setFont(new Font("宋体", Font.BOLD, 15));
        leftBox.add(addUserButton);
        leftBox.add(Box.createVerticalStrut(30));

        JLabel anchorLabel = new JLabel("主播房间号:");
        anchorLabel.setFont(new Font("宋体", Font.BOLD, 15));
        anchorNum = new JTextField();
        anchorNum.setPreferredSize(new Dimension(30, 50));
        anchorNum.setFont(new Font("宋体", Font.BOLD, 25));
        leftBox.add(anchorLabel);
        leftBox.add(anchorNum);
        leftBox.add(Box.createVerticalStrut(30));

        enterAnchorRoom = new JButton("进入&切换牌子");
        enterAnchorRoom.setFont(new Font("宋体", Font.BOLD, 15));
        leftBox.add(enterAnchorRoom);
        leftBox.add(Box.createVerticalStrut(30));

        startSend = new JButton("开始发送弹幕");
        startSend.setFont(new Font("宋体", Font.BOLD, 15));
        leftBox.add(startSend);
        leftBox.add(Box.createVerticalStrut(30));

        stopSend = new JButton("停止发送弹幕");
        stopSend.setFont(new Font("宋体", Font.BOLD, 15));
        leftBox.add(stopSend);
        leftBox.add(Box.createVerticalStrut(30));


        Box box2 = Box.createHorizontalBox();
        box2.add(Box.createHorizontalStrut(8));
        box2.add(leftBox);   //左边的按钮部分用 box布局

        leftContent = new JPanel();
// leftContent.setPreferredSize(new Dimension(250, 0)); //使用该方法
        leftContent.setLayout(new BorderLayout());
        leftContent.add(box2, BorderLayout.NORTH);

        // 右侧表格
        users = new Object[10][usersTableTitle.length];
        userTable = new JTable(users, usersTableTitle);//组件的创建
// userTable.setEnabled(false);
        JScrollPane scrollPane = new JScrollPane(userTable);
        rightContent = new JPanel();
        rightContent.setLayout(new BorderLayout());
        rightContent.add(new JLabel("用户列表"), BorderLayout.BEFORE_FIRST_LINE);
        rightContent.add(scrollPane, BorderLayout.CENTER);//把表格 放jpanel5里
        // 右下弹幕输入
        barrages = new JTextArea(10, 40);
        barrages.setLineWrap(true);
        barrages.setFont(new Font("宋体", Font.BOLD, 15));
        barrages.setText("666");
        JScrollPane barragesScrollPane = new JScrollPane(barrages);
        barragesScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);// 设置滚动条
        barragesScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);// 设置滚动条


        Box rightBottomBox = Box.createHorizontalBox();
        safeStatus = new JButton("保存弹幕");
        safeStatus.setFont(new Font("宋体", Font.BOLD, 15));
        rightBottomBox.add(safeStatus);
        delCurStatus = new JButton("删除当前弹幕");
        delCurStatus.setFont(new Font("宋体", Font.BOLD, 15));
        rightBottomBox.add(delCurStatus);
        delUserNum = new JTextField();
        delUserNum.setPreferredSize(new Dimension(10, 20));
        delUserNum.setFont(new Font("宋体", Font.BOLD, 15));
        rightBottomBox.add(delUserNum);
        delUser = new JButton("删除用户");
        delUser.setFont(new Font("宋体", Font.BOLD, 15));
        rightBottomBox.add(delUser);

        safeUsers = new JButton("保存用户");
        safeUsers.setFont(new Font("宋体", Font.BOLD, 15));
        rightBottomBox.add(safeUsers);
        Box barragesBox = Box.createVerticalBox();
        barragesBox.add(barragesScrollPane, BorderLayout.SOUTH);
        barragesBox.add(rightBottomBox);
        rightContent.add(barragesBox, BorderLayout.SOUTH);

        mainFrame.setLayout(new BorderLayout());
        mainFrame.add(rightContent, BorderLayout.EAST);
        mainFrame.add(leftContent, BorderLayout.WEST);//把两个大的panel放到窗口里面
    }
 }

联系我QQ 2039808149 欢迎讨论交流

原网站

版权声明
本文为[noobmantest]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_43960044/article/details/126242639