Based on the analysis of the emotions and mentality of site B users watching videos, this paper proposes a method to visualize important attributes such as high-frequency words, the proportion of positive and negative comments, and word cloud diagrams. In the context of the rise of the Internet and the increasing application of Web 2.0, this paper took the Bilibili barrage text as the research object. Because of the large amount of barrage data, only individual barrages were selected as the analysis objects according to the requirements. The crawler was used to preprocess the crawled video barrage. Then machine translation knowledge and four algorithms such as the word segmentation algorithm and sentiment analysis algorithm were used to analyze the sentiment of the video barrage from three different dimensions and compare the results. Through the analysis of the visualization results, the differences in the emotional distribution of different video barrages were compared, and two important conclusions were drawn: First, the mentality of Bilibili users watching videos is positive; second, there is a certain correlation between the content of the video and the emotional orientation of the barrage, and mutual prediction can be made between the two. However, the research in this paper is only the tip of the iceberg in the research of public opinion analysis. At present, the application of sentiment analysis in public opinion still faces difficulties. How to optimize the algorithm model according to the current situation requires researchers to conduct deeper research and more extensive thinking.