Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Mitmproxy to crawl official account articles in Python

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to use Mitmproxy to crawl the official account article in Python, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Set the agent IP on the mobile side to the IP address on the PC side

When we have installed the certificate, we can do the following. First enter cmd in the start bar of the PC, and then enter the control command ipconfig to view the IP address on the PC, as shown in the following figure

Then open the manual setting of the proxy ip in the connected wifi option on the mobile phone, enter the user name into the IPv4 address, and generally set the port to 8080.

Crawl the article reading information

Once we have done this, we will do the following in the py code.

Code modification operation

In the reference blog, we only need to modify the py code wxCrawler.py, and the rest of the code does not need to be modified, because this code is the key to crawling articles. We can change the crawling link of the wxCrawler.py code to the reading information of the crawled article; wxCrawler.py imports the text_01.py code class of the reference blog at the for loop and passes the corresponding parameters (the reference blog is the articles.py code); only make this one modification to complete the crawling of the official account article reading information.

Text_01.py code

Modified wxCrawler.py code

Example of run result:

Taking the official account as an example, the test result chart is as follows

Matters needing attention

Item 1: put all the py code in the same folder.

Item 2: before reading this blog, please read the reference blog and the blog about the difficult points of the reference blog.

Item 3: try to use pycharm to open a folder to run py code.

Item 4: refer to the code in the blog, there are code indentation, symbols and other problems, in the last blog I have modified it, just need to change the wxCrawler.py code to the modified code and then add the text_01.py code.

This is the answer to the question about how to use Mitmproxy to climb the official account in Python. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report