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 :

  1. Simulated Login ;
  2. Like it ;

After extending this requirement , There are two common business scenarios .

  1. 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 ;
  2. 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 :

  1. 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 ;
  2. 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

  1. Verification code identification problem ;
  2. 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 whole network is universal Python Like machine ( Commonly known as brush machine ), Want to know the principle ? After reading this article, you can write one yourself

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 .

 The whole network is universal Python Like machine ( Commonly known as brush machine ), Want to know the principle ? After reading this article, you can write one yourself

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

Random recommended