Jun 01, 2021 Article blog
This article was reproduced to Know ID: Charles (Bai Lu) knows his personal column
Download the W3Cschool Mobile App, 0 Foundation Anytime, Anywhere Learning Programming >> Poke this to learn
Use python crawl fish C forum latest popular post information and do a brief analysis, I believe that many people are no stranger to fish C forum, after all, the course of small fish production for novices or very friendly drops, basically are more derogatory state.
Let's get off to a pleasant start
Python version: 3.6.4
Related modules:
requests module;
pyecharts module;
Jieba module;
wordcloud module;
and some Python's own modules.
Install Python and add it to the environment variable, and pip installs the relevant modules that are required.
Grab target:
Fish C forum latest popular post information:
It's possible to crawl information for all posts with the requests module and regular expressions.
Analysis objectives:
Visualize the crawled post information data to see how to post to get fish C hot.
The visual analysis of information data is mainly realized by pyecharts and wordcloud modules.
Information crawl:
Run the FCSpider.py file in the cmd window, as shown in the following image:
data analysis:
Run the analysis.py file in the cmd window.
First let's take a look at which section of the Fish C Forum is more popular:
Obviously, Python Big Brother dominates, accounting for 56.19% of all hot posts in the Fish C Forum, so I want to go on the Fish C Forum hot post, of course, the preferred Python theme ah!
Perhaps some people will say that the number of posts does not explain the problem ah, in case someone maliciously brush the post?
(a potentially inappropriate analogy), let's analyze and analyze the number of participants, replies, and views for each post!
The first is the number of participants (none of which are heavy):
Python's share of the top 10 hot posts was also high, as follows:
So in terms of the number of participants, python is still out of the picture.
Take a look at the number of replies and views:
The conclusion is still unchanged, it seems that want to mix a hot post in the fish C forum, send python theme is the best choice.
Finally, we'll make the titles of all the hot topics into word clouds to see how we can become a qualified "title party":
OK, you can happily go to the water paste to get hot
Full source code and results can be found in the relevant documents.
The code will be tested correctly by August 31, 2018