Fat theory film - the battle of two cities

original intention

Someone might ask? Why should I do this as a programmer? There are a lot of movie video commentary on the Internet. Do I have to come to see you? Let me answer the question. In this column, I want to try to combine technology with life. While learning technology, you also gain happiness. After reading this article, you feel that you have learned the spirit and technology in the film, then this article is worth it. Well, let's get to today's topic

Battle of two cities

brief introduction

Introduce: "League of Heroes: Battle of two cities" is the official animation series of the League of heroes. It tells the story of Wei and jinkesi sisters in the Utopia full of Steampunk atmosphere - piltwaff and the underground city driven by chemicals - zu'an. After a fierce conflict, they found that they stood opposite each other. From then on, they separated, embarked on different roads and walked towards different destiny ends, but the fetters in their hearts made the two sisters want to make up as before### Start operation

Introduction to key figures:



Policewoman is my favorite hero 😃





I don't know which of these heroes in the game do you like best?

Start operation


From the introduction, we learned about the general characters and stories. So many of our players want to know whether this animation can make us love it as much as we love games. What you say doesn't count, nor do I. Let's listen to the public.
We found the address of a valve: Portal


We want to know what you think and need to get every comment
Through the observation of the web page, it is found that each comment is hidden in such a P tag, so we write such a function:

def comment(n):
    comments=[]
    url=("https://movie.douban.com/subject/34867871/comments?start=%d&limit=20&status=P&sort=new_score"%n)
    headers={
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'
    }
    res=requests.get(url=url,headers=headers).text
    soup=BeautifulSoup(res,"lxml")
    comment_list=soup.find_all(attrs={"class":"short"})
    for i in comment_list:
        comments.append(i.text)
    print("Climb 20 successful comments")
    return comments

In order to get more, we have constructed a function:

allComment=[]
for i in range(0,10000,20):
    allComment=comment(i)+allComment
    print("Successfully written%d Comments"%i)

Well, now is the time to analyze the comments:

text="".join(allComment)
cut_text="".join(jieba.cut(text))

color_list=['#FF0000','#9955FF','#66FFFF','#00FF00','#FFA500','#F08080']#Create color array
colormap=colors.ListedColormap(color_list)#call
#color_mask = cv2.imread("img.png")
word_cloud=WordCloud(
    font_path="msyh.ttc",
    background_color='black',
    mode="RGBA",
    prefer_horizontal=1,
    #mask=color_mask,
    height=500,
    width=800,
    scale=1,
    colormap=colormap,#Set color
    margin=5
)

word_cloud1=word_cloud.generate(cut_text)
word_cloud1.to_file('2.png')

print("Picture saved successfully")

Let's look at the effect first:

Everyone has a panoramic view of this animation.
Next, we're trying to make it more beautiful. Use this picture as the background border:

The results obtained are as follows:

. . . I can only say that it was really a failure! It may be that opencv didn't divide the edges of the characters very thin when processing the gray level of the picture. Maybe it's my font modulation. Let's try another picture

result:

Is it much better, hee hee.

last

At present, it is the first issue of film review analysis. You are welcome to make suggestions, and the analysis direction will be added later. You can also leave a message below about the movies you want to see or give me suggestions. I'll see you in the next movie.

Special introduction

📣 Xiaobai training column is suitable for newcomers who have just started. Welcome to subscribe Programming Xiaobai advanced

📣 The interesting Python hand training project includes interesting articles such as robot awkward chat and spoof program, which can make you happy to learn python Training project column

📣 In addition, students who want to learn java web can take a look at this column: Teleporters

📣 This is a sprint factory interview column and algorithm competition practice. Let's cheer together The way ashore

Click to receive the data directly

There are python, Java learning materials, interesting programming projects and various resources that are hard to find. It's not a loss to look at it anyway.

Keywords: Python Data Analysis

Added by wilzy1 on Fri, 17 Dec 2021 03:46:39 +0200