Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”
This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.
Writing in the front
Dream eraser, a person who is determined to become an influencer in the IT circle, and today, I have achieved 10%
Today, I plan to write a series of articles about reptiles. In the process of browsing, I arrived at Zhihu and saw a lot of fitness girls. Well, my figure is very good. As a small dish that can barely be regarded as a crawler, this simple is not good. After one meal of operation, I found that I was stuck in zhihu login. I planned to write a simulated login by myself, but later I thought that I did not want to build wheels, so I went to Github to find a ready-made incense.
Thus came this article
DecryptLogin library
Project source: github.com/CharlesPika…
The project is a library to implement various logins, and the project declaration is very interesting
This project is intended for python enthusiasts only and will be removed immediately if the author finds it being used in any improper way.
I hope you can make good use of this project 🙂
Well, this item is for hobbyists, if you do bad things, I will delete this item, very nice.
Whether a library is good or not, remember how we judge, see his documentation is good or not, good documentation, library generally not bad
Chinese document: httpsgithubcomcharlespikachudecryptlogin. Readthedocs. IO/useful/latest/I…
If you open it, you can see that there are quite a few supported platforms, and the library was updated 3 days ago (today is June 19, 2020), proving that the library is still under maintenance.
Encoding time
I don’t want to go into details, but the basic premise is that this library can run. Go
pip install DecryptLogin –upgrade
Python3.6 or higher is required for this library
The requirements for DecryptLogin dependencies are as follows:
Rsa >= 4.0 qrcode >= 6.1 Pillow >= 6.0.0 requests >= 2.22.0 Pycryptodome >= 3.8.1 Requests_Toolbelt >= 0.9.1 PyExecJS >= 1.5.1 (The Test version of Node.js is V10.15.3)
Then you can get started quickly, and the official documentation is very simple
Three lines of code to simulate login
I have one line of code in this title, was called the connotation of the goddess deskmate: blog.csdn.net/hihell/arti…
Three lines of code later, I was caught off guard, and of course entered a captcha.
from DecryptLogin import login
lg = login.Login()
infos_return, session = lg.zhihu(username='Your account', password="Your password")
print(infos_return,session)
Copy the code
Even better, captcha processing can also support the docking of cryptography platforms, which is already pretty good, and is good enough for our initial goal of simulating login
from DecryptLogin import login
Define the captcha recognition function
def crackvcFunc(imagepath) :
# Open captcha image
img = Image.open(imagepath)
# Identify captcha images
result = IdentifyAPI(img)
# return the recognition result (which is a digital verification code)
return result
lg = login.Login()
infos_return, session = lg.zhihu(username='Your Username', password='Your Password', crackvcFunc=crackvcFunc)
Copy the code
Write in the back
If you don’t want to build wheels, direct use of the open source project is ok, of course, open his source code, a good analysis, copy, or can learn a lot of things, and copy in the early learning is the best, but also the most effective way to learn
A lot of times, we can’t solve technology problems, not because we don’t have good technology, but because we don’t know how to do it
This article hopes you heard today that there is actually a DecryptLogin library.