zoukankan      html  css  js  c++  java
  • Python自动发射弹幕

    Python自动发射弹幕,弹幕护体

    - 环境: Python3+Windows
    - 开发工具: PyCharm 

    学习效果:
    1. 学会使用Python刷弹幕
    2. 配置INI文件信息
    3. 掌握网络请求知识
    4. 解浏览器开发者工具
    5. 时间模块的使用
    6.爬虫的基本知识

    https://www.bilibili.com/video/av11149694/

    手动发送两条弹幕,抓包查看表单数据,找出不同的参数,注意相应修改

    用户登录信息,消息头-cookie

     脚本如下:

    #coding=utf-8
    import requests,time,random
    import configparser  #配置文件信息
    
    target = configparser.ConfigParser() #文件对象
    target.read(r'D:	.ini',encoding='utf-8')  #读取文件
    while True: #message = target['我的弹幕'][str(random.randint(1,8))] message = target.get('我的弹幕',str(random.randint(1,8))) url = 'https://interface.bilibili.com/dmpost?cid=18447007&aid=11149694&pid=1&ct=1' cookie = {'cookie':''} form = {'fontsize':'25', 'pool':'0', 'mode':'1', 'color':'16777215', 'rnd':str(time.time()*1000000),#时间戳 'message':message, 'playTime':'0.08', 'cid':'18447007', 'date':time.strftime('%Y-%m-%d+%H:%M:%S',time.localtime(time.time())), #'date':time.strftime('%Y-%m-%d+%X', time.localtime(time.time())), 'csrf':'3915a57109e4abe13dc752254df4bc35' } requests.post(url,cookies=cookie,data=form) # requests.request('POST',url, data=form,cookies=cookie) print(message) time.sleep(5)

     

    配置文件如下: 

  • 相关阅读:
    docker的应用部署
    docker容器的数据卷
    找到最终的安全状态 深搜
    park和unpark方法详解
    docker容器相关命令
    docker鏡像相關命令
    join方法底层实现
    Elasticsearch启动过程错误汇总
    MySQL 8.0.12 报错The table does not comply with the requirements by an external plugin. (errno 3098)
    docker login 密码查看和加密保存
  • 原文地址:https://www.cnblogs.com/feiyueNotes/p/8097632.html
Copyright © 2011-2022 走看看