Python Auto Launch bullet screen

Source: Internet
Author: User

Python auto-launch bomb screen, bullet screen protection body

-Environment: Python3+windows
-Development tools: Pycharm

Learning effect:
1. Learn how to use Python to brush the bullet screen
2. Configuring INI file Information
3. Mastering Network Request Knowledge
4. Solution Browser Developer Tools
5. Use of the time module
6. Basic knowledge of reptiles

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

Manually send two bullets, grab the packet to view the form data, find out the different parameters, notice the corresponding modification

User login information, message header-cookie

The script is as follows:

#coding =utf-8import requests,time,randomimport Configparser #配置文件信息target = Configparser. Configparser () #文件对象target. Read (R ' D:\t.ini ', encoding= ' utf-8 ') #读取文件
While True: #message = target[' My barrage '][str (Random.randint (1,8))] message = Target.get (' My pinball ', str (random.randint (1,8)) url = ' https://interface.bilibili.com/dmpost?cid=18447007&aid=11149694&pid=1&ct=1 ' cookie = {' Cookie ': '} form = {' fontsize ': ' + ', ' pool ': ' 0 ', ' mode ': ' 1 ', ' Color ': ' 16777215 ', ' rnd ': Str (time.tim E () *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.R Equest (' POST ', URL, data=form,cookies=cookie) print (Message) Time.sleep (5)

 

The configuration file is as follows:

Python Auto Launch bullet screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.