danmu icon indicating copy to clipboard operation
danmu copied to clipboard

一个基于python实现的斗鱼弹幕自动发送脚本

简介(测试时候用,自己用的话用js脚本完成,可以在暴力猴里面写js实现)

通过selenium自动发送斗鱼弹幕,模仿真实操作,避免封禁风险。首次运行需要采用二维码扫描登陆,提高安全性,便捷性,提高登陆成功概率。以后运行会自动读取保存到本地的cookie文件,实现真正的免人为操作。安装测试环境:python3;MacOS Catalina 10.15/Ubuntu 16.10/WIN10;Chrome/Firefox

2020/11/30 不再了更新了,写的很明白了,页面变动的话自己改改就可以了,授人以鱼不如授人以渔

2019/11/2 进行第二次更新,改进了代码逻辑

2018/11/24 斗鱼修改了页面,进行第一次更新

安装运行

  1. 下载代码(Windows用户请在git-bash里执行)

     git clone https://github.com/masterzht/danmu.git
    
  2. 安装Python 3.x

     https://www.python.org/getit/
    
  3. 目前支持的浏览器有firefox,chrome,默认选择的webdriver是windows下的chrome驱动,如需修改,请更改executable_path。

     driver = webdriver.Chrome(executable_path="./driver/win/chromedriver", chrome_options=options)
    
  4. 在命令行里运行

     python3 danmu.py
    

chrome驱动下载位置:http://chromedriver.chromium.org/downloads

firefox驱动下载位置:https://github.com/mozilla/geckodriver/releases

edge驱动下载位置:https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

selenium使用参考:https://github.com/lmz2932/learnselenium