Python crawler entry combat 4: get CSDN blog comments and add new comments

☞ ░LaoYuan Python blog post directory: https://blog.csdn.net/LaoYuanPython/article/details/98245036

I. Introduction

In the previous chapter, we introduced the crawling of CSDN article content. The HTTP GET method is used. The returned content can be quickly parsed through BeatifulSoap. In this section, you need to use the HTTP POST method to obtain blog comments and submit new comments. The return data is In plain text format, non-SOAP methods need to be used for parsing.

2. Obtaining the message content in the blog post comment area

2.1. HTTP request to get the content of the comment area

To obtain the comment information of a blog post through a crawler, you first need to obtain the HTTP request and response related to the comment information. After starting the developer mode and refreshing the page with the browser, a series of HTTP visits and responses will be captured. As shown in the figure: the
Insert picture description here
red circle above is triggered by the refresh of the blog post content, but the message information of the comment content is not found in the response message &

Guess you like

Origin blog.csdn.net/LaoYuanPython/article/details/114461023