current position:Home>The universal Python praise machine (commonly known as the brushing machine) in the whole network. Do you want to know the principle? After reading this article, you can write one yourself
The universal Python praise machine (commonly known as the brushing machine) in the whole network. Do you want to know the principle? After reading this article, you can write one yourself
2022-01-30 03:32:11 【Dream eraser】
This article has participated in 「 Digging force Star Program 」 , Win a creative gift bag , Challenge creation incentive fund .
In today's , Any community platform , All have the like function , What came into being was the automatic likes machine , Commonly known as brush extension / Praise machine .
This article will introduce you to a like robot , The most simple and easy to understand core logic .
Pseudo code involved in the full text , Use Python To write , Because it's pseudo code , Don't understand, Python, You can understand .
This blog trial scenario
This time I like robot , It's mainly for computers Web Site , Don't involve APP End .
Like the core logic of the robot
Simulation click operation , Trigger likes , Like to wait for the operation .
Before you like it , There's another important code implementation , Simulated Login .
therefore , The basic requirements of the like robot are as follows :
- Simulated Login ;
- Like it ;
After extending this requirement , There are two common business scenarios .
- Log in to a large number of accounts through simulation , Implement for “ One person / One thing / One article / A video ” A lot of likes , That is to brush others' points ;
- By logging into an account , Implement for “ Many people ” I like it in bulk , That is to brush your own points .
Code level implementation
After sorting out the basic logic , You can enter the actual coding process .
Simulated Login
On the login implementation , There are two ways of thinking :
- A lot of registration ( You can also buy ) account number , adopt Python The program switches accounts , Every time I log in like , Switch to the next account ;
- Advance by technical or manual means , Simulated Login , Record the account generated after login Cookie, Follow up maintenance Cookie The pool implements the operation logic .
The second problem is Cookie The issue of validity , If the website has no such restriction , It is suggested that this method be adopted , More efficient .
Pseudo code implementation
# Train of thought
with open("users.txt","r") as f:
user_pass = f.readline()
# Simulated Login
login(user_pass)
# Complete the post login operation
do_someting()
# Train of thought two
with open("cookies.txt","r") as f:
one_cookie = f.readline()
# By carrying cookie Parameter access interface
get_detail(one_cookie)
Copy code
The second one is Cookie pool , It can be created manually or by program .
In the simulation login section , You will encounter two learning difficulties
- Verification code identification problem ;
- IP Anti climbing limit .
- One of the most accessible solutions , Docking coding platform .
- The second difficulty is the solution , Buy IP Agent pool , You can also build your own agent pool , Focus on project cost and stability requirements .
Like machine
In many projects , When you have finished the simulated Login operation , Has said that the website is good for you It's completely open .
The next thing you need to do is find the like interface , For example, the following case ( For reference only ):
CSDN Like interface is as follows :
# POST Pass user ID and article ID
Request URL: https://blog.csdn.net//phoenix/web/v1/article/like
Request Method: POST
# POST The parameters are as follows
articleId=118558076
Copy code
Zhihu like interface is as follows :
# direct POST Pass on , The user ID is in Cookie in
Request URL: https://www.zhihu.com/api/v4/zvideos/1391420717800554497/likers
Request Method: POST
Copy code
bilibili Like interface is as follows :
# Passing the user ID at the same time , Pass the corresponding parameters
Request URL: https://api.bilibili.com/x/web-interface/archive/like
Request Method: POST
# POST The parameters are as follows
aid: 631588341
like: 1
csrf: b39b26b6b8071e2f908de715c266cb59
Copy code
Through the above cases , You'll find that , The format of the like operation interface is basically similar , It's all through POST Pass on Cookie With specific parameters to the server .
among B The station is special , With one csrf
Parameters , This parameter can be accessed from Cookie It's extracted directly from .
Pseudo code implementation
import requests
def like(params):
# Request header Cookie Obtained by simulated Login
cookie = get_cookie()
# cookie = login()
headers = {
" Other attributes ":" Property value ",
"Cookie":cookie # Focus on the user ID Cookie
}
res = requests.post(" Address "," Parameters "," Request header ")
Copy code
In the call like interface section , You will come across a learning difficulty
- The interface contains positional parameters , For example, the above B The site likes
csrf
, For solutions to unknown parameters, please refer to the following description .
Keep taking it B For example , Open browser developer tools , Switch to network
tab , When you click like , There will be like data requests , As shown in the figure below .
The request appeared at the same time POST Related parameters of , Next , All you have to do is press on the keyboard Ctrl+F
, Open the search window ( It's in the current developer tools network
Tab ), In the search box , Enter the value to retrieve , You can find all the request locations where the value appears , Then follow up analysis can be done . The key point is to find the position and principle of the parameter value .
Like robot summary
There are various application scenarios of auto like robot , Accurately speaking , This operation can cause some platform imbalances , It will also affect the fairness of platform data , But it's because of the demand , So there are a lot of likes on the market right now , Brush divider , Commenter , There are even a large number of companies running such businesses .
We don't support this kind of business , But you can learn how it works . After all, use Python Implement an automation tool , After understanding the principle , It's going to be very simple .
I hope this article will let you , Realize a niche brush machine of your own , And then I can like all my blogs ,
copyright notice
author[Dream eraser],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201300332090988.html
The sidebar is recommended
- Getting started with Python - object oriented - special methods
- Using linear systems in python with scipy.linalg
- Fast power modulus Python implementation of large numbers
- Python architects recommend the book "Python programmer's Guide" which must be read by self-study Python architects. You are welcome to take it away
- Decoding the verification code of Taobao slider with Python + selenium, the road of information security
- Python game development, pyGame module, python implementation of skiing games
- Python collects and monitors system data -- psutil
- Python + selenium automated test: page object mode
- You can easily get started with Excel. Python data analysis package pandas (IV): any grouping score bar
- Python ThreadPoolExecutor restrictions_ work_ Queue size
guess what you like
-
Python generates and deploys verification codes with one click (Django)
-
[Python kaggle] pandas basic exercises in machine learning series (6)
-
Using linear systems in python with scipy.linalg
-
Using Python to realize national second-hand housing data capture + map display
-
How to make Python run faster? Six tips!
-
Python chat room (Tkinter writing interface, streaming, socket to realize private chat, group chat, check chat records, Mysql to store data)
-
This pandas exercise must be successfully won
-
[algorithm learning] sword finger offer 64 Find 1 + 2 +... + n (Java / C / C + + / Python / go / trust)
-
Understand Python's built-in function and add a print function yourself
-
Python implements JS encryption algorithm in thousands of music websites
Random recommended
- leetcode 35. Search Insert Position(python)
- [introduction to Python visualization]: 12 small examples of complete data visualization, taking you to play with visualization ~
- Learning this Python library can reduce at least 100 lines of code
- leetcode 67. Add Binary(python)
- Regular re parameter replacement of Python 3 interface automation test framework
- V. pandas based on Python
- Only 15 lines of code is needed for face detection! (using Python and openCV)
- [Python crawler Sao operation] you can crawl Sirius cinema movies without paying
- leetcode 69. Sqrt(x)(python)
- Teach you to read the source code of Cpython (I)
- Snowball learning started in the fourth quarter of Python. One needs three meals. I have a new understanding of Python functional programming, process-oriented, object-oriented and functional
- leetcode 88. Merge Sorted Array(python)
- Don't you know more about a python library before the end of 2021?
- Python crawler web page parsing artifact XPath quick start teaching!!!
- Use Python and OpenCV to watermark the image
- String and related methods of Python data type introduction
- Heapq module of Python module
- Introduction to beautiful soup of Python crawler weapon, detailed explanation, actual combat summary!!!
- Event loop of Python collaboration series
- Django docking pin login system
- [recalling the 1970s] using Python to repair the wonderful memories of parents' generation, black-and-white photos become color photos
- You used to know Python advanced
- Pyinstaller package Python project
- 2021 IEEE programming language rankings: Python tops the list!
- Implementation of Python automatic test control
- Python advanced: [Baidu translation reverse] graphic and video teaching!!!
- Do you know the fuzzy semantics in Python syntax?
- [Python from introduction to mastery] (XXVII) learn more about pilot!
- Playing excel office automation with Python
- Some applications of heapq module of Python module
- Python and go languages are so popular, which is more suitable for you?
- Python practical skills task segmentation
- Python simulated Login, numpy module, python simulated epidemic spread
- Python opencv contour discovery function based on image edge extraction
- Application of Hoff circle detection in Python opencv
- Python reptile test ox knife (I)
- Day 1: learn the Django framework of Python development
- django -- minio_ S3 file storage service
- [algorithm learning] 02.03 Delete intermediate nodes (Java / C / C + + / Python / go)
- Learning in Python + opencv -- extracting corners