Backend Development
Python Tutorial
Python crawls Leslie Cheung's 8 most popular songs, with 60,000 comments and I burst into tears after reading them!Python crawls Leslie Cheung's 8 most popular songs, with 60,000 comments and I burst into tears after reading them!
Yesterday was April 1st.
On this day every year,
some people search hard and think of ways to play tricks,
some people feel that April would be great, if you are still here.
There are even people who use AI to restore you.
But it’s not you after all.

See watermark for picture source
It’s been 16 years since you left. Those teenagers who secretly listened to your songs at the desk when the teacher wasn’t paying attention, Perhaps she has been a husband and a wife for a long time.
Even so, every year, many people miss you and leave you messages through the endless echoes you leave to the world in April. Even if they know it clearly, they will never A reply will be received.

Now, we choose to use technology to commemorate our brother.
We crawled your eight songs with the most comments on NetEase Cloud Music.
They are: "Silence is Golden", "Spring, Summer, Autumn and Winter", "A Chinese Ghost Story", "When Love Is a Past", "Me", "The Wind Keeps Blowing", "The Love of Glass" and "When the Wind Rises Again".
Among the 64,540 comments in total, the most common ones were "Happy birthday," "Brother," "Come on," "If you are still here," "Happy New Year," and "Happy birthday, brother."

There are very few words like "April 1st" and "April Fool's Day" in the word cloud chart. This is not because there are few people commenting on this day, but because On this day, it is really not the right time to say "Happy" to you.
Come on, let me show you the code of the comment first.
# coding:utf-8
import json
import time
import requests
from fake_useragent import UserAgent
import random
import multiprocessing
import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
ua = UserAgent(verify_ssl=False)
song_list = [{'186453':'春夏秋冬'},{'188204':'沉默是金'},{'188175':'倩女幽魂'},{'188489':'风继续吹'},{'187374':'我'},{'186760':'风雨起时'}]
headers = {
'Origin':'https://music.163.com',
'Referer': 'https://music.163.com/song?id=26620756',
'Host': 'music.163.com',
'User-Agent': ua.random
}
def get_comments(page,ite):
# 获取评论信息
# """
for key, values in ite.items():
song_id = key
song_name = values
ip_list = [IP列表]
url = 'http://music.163.com/api/v1/resource/comments/R_SO_4_'+ song_id +'?limit=20&offset=' + str(page)
proxies = get_random_ip(ip_list)
try:
response = requests.get(url=url, headers=headers,proxies=proxies)
except Exception as e:
print (page)
print (ite)
return 0
result = json.loads(response.text)
items = result['comments']
for item in items:
# 用户名
user_name = item['user']['nickname'].replace(',', ',')
# 用户ID
user_id = str(item['user']['userId'])
print(user_id)
# 评论内容
comment = item['content'].strip().replace('\n', '').replace(',', ',')
# 评论ID
comment_id = str(item['commentId'])
# 评论点赞数
praise = str(item['likedCount'])
# 评论时间
date = time.localtime(int(str(item['time'])[:10]))
date = time.strftime("%Y-%m-%d %H:%M:%S", date)Lyric codes for eight songs:
import requests
from bs4 import BeautifulSoup
import re
import json
import time
import random
import os
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3355.4 Safari/537.36',
'Referer': 'http://music.163.com',
'Host': 'music.163.com'
}
# 获取页面源码
def GetHtml(url):
try:
res = requests.get(url=url, headers=headers)
except:
return None
return res.text
# 提取歌手歌词信息
def GetSongsInfo(url):
print('[INFO]:Getting Songs Info...')
html = GetHtml(url)
soup = BeautifulSoup(html, 'lxml')
links = soup.find('ul', class_='f-hide').find_all('a')
if len(links) < 1:
print('[Warning]:_GetSongsInfo <links> not find...')
Info = {'ID': [], 'NAME': []}
for link in links:
SongID = link.get('href').split('=')[-1]
SongName = link.get_text()
Info['ID'].append(SongID)
Info['NAME'].append(SongName)
# print(Info)
return Info
def GetLyrics(SongID):
print('[INFO]:Getting %s lyric...' % SongID)
ApiUrl = 'http://music.163.com/api/song/lyric?id={}&lv=1&kv=1&tv=-1'.format(SongID)
html = GetHtml(ApiUrl)
html_json = json.loads(html)
temp = html_json['lrc']['lyric']
rule = re.compile(r'\[.*\]')
lyric = re.sub(rule, '', temp).strip()
print(lyric)
return lyric
def main():
SingerId = input('Enter the Singer ID:')
url = 'http://music.163.com/artist?id={}'.format(SingerId)
# url = "http://music.163.com/artist?id=6457"
Info = GetSongsInfo(url)
IDs = Info['ID']
i = 0
for ID in IDs:
lyric = GetLyrics(ID)
SaveLyrics(Info['NAME'][i], lyric)
i += 1
time.sleep(random.random() * 3)
# print('[INFO]:All Done...')
def SaveLyrics(SongName, lyric):
print('[INFO]: Start to Save {}...'.format(SongName))
if not os.path.isdir('./results'):
os.makedirs('./results')
with open('./results/{}.txt'.format(SongName), 'w', encoding='utf-8') as f:
f.write(lyric)01
"Silence is Golden"
It’s wrong, it’s never right, it’s always true
No matter what you say, I’ll stick to my duty
Always believe silence is golden
This song was composed by you yourself.
At that time, the "Tan-Chang Hegemony" (from 1986 to 1989, Alan Tam and Leslie Cheung launched a comprehensive competition in music to compete for status in the music industry) had entered a fever pitch.
You hate fighting, so you borrowed a song to express your ambition and released "Silence is Golden".
You said, "No matter what you say, I will stick to my duty and always believe that silence is golden."
The pure will purify themselves, and your silence will further demonstrate your innocence.
02
《Spring, Summer, Autumn and Winter》
Autumn should be great if you are still here
Even if the autumn wind is cool, it is still beautiful
You in the late autumn fill my dreams
Like fallen leaves flying and tapping on my window
Every time it’s your birthday, every New Year, or every day you leave this world, there will be a lot of comments under your songs.
You left on April 1st, but people who like you always come to comment on your music on March 30th, 31st or even earlier.
So many people hope that you will be resurrected. Some people even saw a taxi driver in Chongqing who looked very similar to you and couldn't help but take a picture.
The clarity and hesitation in your eyes are still so unforgettable after all these years.

03

04
##"When Love Is a Past"
Why don’t you understand
As long as there is love, there will be pain
One day you will know
Life will not be different without me
In "Farewell My Concubine", you played Cheng Dieyi.
You acted so charmingly that some people asserted that you were born in Tongzi Gong.
Actually, you are just continuing to train despite being seriously ill.
You said "If you don't go crazy, you won't survive", so you know that after Duan Xiaolou marries a wife, he will be jealous, sad and crazy.
You have loved both on and off the screen. You said, "As long as there is love, there will be pain", but it is more like singing it to yourself.

You are so pure and "accepting death" that your fans always feel sorry for you...
05
《我》
The same nakedness that blooms in the lonely desert
How happy Live happily in the glass house
What is light and aboveboard to the world
I am I am fireworks with different colors
How many people use the phrase you sang, "I am who I am, just like fireworks of different colors" to encourage themselves to live out their lives.
But in the end you left this world like fireworks.
A few years ago, Tony Leung dialed your phone number at a concert to commemorate you.
On the phone, the message was still there, "Hello, I'm Leslie, please leave a message if you need anything."

Liang Chaowei was silent, and after a long time, he said calmly Sentence: "Baorong, why don't we start from scratch."
06
《风continues to blow》
The wind continues to blow and I can’t bear to stay away
There are tears in my heart and I don’t want to shed tears as I look at you
So many happy memories in the past
Why not chase it with you
This is your famous song, so you seem to like it very much.
Every time I attend a concert, I have to sing.
When you sang for the last time, you cried for some reason, and the audience also cried with you.


Because this song is a testimony of your turnaround.
You have been in the music industry for so many years, but you have always been silent. This song has prevented you from being buried.
07
08

I wonder if you are still singing now? Are you still acting?
Do you know that many people are thinking of you.
Thank you for leaving us so many songs and movies.
May you never be depressed or sad in another world.
above.
This article has ended here. For more exciting content, you can pay attention to the Python Video Tutorial column on the PHP Chinese website! ! !
The above is the detailed content of Python crawls Leslie Cheung's 8 most popular songs, with 60,000 comments and I burst into tears after reading them!. For more information, please follow other related articles on the PHP Chinese website!
The Main Purpose of Python: Flexibility and Ease of UseApr 17, 2025 am 12:14 AMPython's flexibility is reflected in multi-paradigm support and dynamic type systems, while ease of use comes from a simple syntax and rich standard library. 1. Flexibility: Supports object-oriented, functional and procedural programming, and dynamic type systems improve development efficiency. 2. Ease of use: The grammar is close to natural language, the standard library covers a wide range of functions, and simplifies the development process.
Python: The Power of Versatile ProgrammingApr 17, 2025 am 12:09 AMPython is highly favored for its simplicity and power, suitable for all needs from beginners to advanced developers. Its versatility is reflected in: 1) Easy to learn and use, simple syntax; 2) Rich libraries and frameworks, such as NumPy, Pandas, etc.; 3) Cross-platform support, which can be run on a variety of operating systems; 4) Suitable for scripting and automation tasks to improve work efficiency.
Learning Python in 2 Hours a Day: A Practical GuideApr 17, 2025 am 12:05 AMYes, learn Python in two hours a day. 1. Develop a reasonable study plan, 2. Select the right learning resources, 3. Consolidate the knowledge learned through practice. These steps can help you master Python in a short time.
Python vs. C : Pros and Cons for DevelopersApr 17, 2025 am 12:04 AMPython is suitable for rapid development and data processing, while C is suitable for high performance and underlying control. 1) Python is easy to use, with concise syntax, and is suitable for data science and web development. 2) C has high performance and accurate control, and is often used in gaming and system programming.
Python: Time Commitment and Learning PaceApr 17, 2025 am 12:03 AMThe time required to learn Python varies from person to person, mainly influenced by previous programming experience, learning motivation, learning resources and methods, and learning rhythm. Set realistic learning goals and learn best through practical projects.
Python: Automation, Scripting, and Task ManagementApr 16, 2025 am 12:14 AMPython excels in automation, scripting, and task management. 1) Automation: File backup is realized through standard libraries such as os and shutil. 2) Script writing: Use the psutil library to monitor system resources. 3) Task management: Use the schedule library to schedule tasks. Python's ease of use and rich library support makes it the preferred tool in these areas.
Python and Time: Making the Most of Your Study TimeApr 14, 2025 am 12:02 AMTo maximize the efficiency of learning Python in a limited time, you can use Python's datetime, time, and schedule modules. 1. The datetime module is used to record and plan learning time. 2. The time module helps to set study and rest time. 3. The schedule module automatically arranges weekly learning tasks.
Python: Games, GUIs, and MoreApr 13, 2025 am 12:14 AMPython excels in gaming and GUI development. 1) Game development uses Pygame, providing drawing, audio and other functions, which are suitable for creating 2D games. 2) GUI development can choose Tkinter or PyQt. Tkinter is simple and easy to use, PyQt has rich functions and is suitable for professional development.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version
Recommended: Win version, supports code prompts!

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version





