Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Python analyzes fish C forum hot posts


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

Lead

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


Related documents

Extract code: wpae

Develop tools


Python version: 3.6.4

Related modules:

requests module;

pyecharts module;

Jieba module;

wordcloud module;

and some Python's own modules.

Environment construction


Install Python and add it to the environment variable, and pip installs the relevant modules that are required.


Introduction to the principle


Grab target:

Fish C forum latest popular post information:

 Python analyzes fish C forum hot posts1

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.


The results are shown

Information crawl:

Run the FCSpider.py file in the cmd window, as shown in the following image:

 Python analyzes fish C forum hot posts2

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:

 Python analyzes fish C forum hot posts3

 Python analyzes fish C forum hot posts4

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 analyzes fish C forum hot posts5

Python's share of the top 10 hot posts was also high, as follows:

 Python analyzes fish C forum hot posts6

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:

 Python analyzes fish C forum hot posts7
 Python analyzes fish C forum hot posts8

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":

 Python analyzes fish C forum hot posts9

OK, you can happily go to the water paste to get hot

Full source code and results can be found in the relevant documents.


more

The code will be tested correctly by August 31, 2018