Write on the front:
This book is only used to record personal learning progress, the knowledge is shallow, if there is any wrong view, please point out in the comment area. Welcome to the exchange. (Some materials are sourced from the network, if there is infringement, delete it immediately)
The code is only used for learning, if it is reproduced for other illegal acts, it is at your own legal responsibility
The code is all original, no reprinting is allowed, reprinting is infringing
Python crawler
The crawling of musical lyrics was realized
Implements crawling of comments and generates word cloud maps
menu
1: Get the lyrics
2: Song review lyrics cloud map
Refer to the blog
This side uses selenium's method of simulating login
The function is as follows:
This line of code converts the cookies obtained in the driver into a format that the requests can use directly
Then write to the file
Read cookies
There is also a mechanism for reading and a mechanism for failing to read
Every song in NetEase Cloud has a unique ID
And almost all of the URLs of NetEase Cloud use ID to transmit parameters
So we need to convert the song title to ID
An interface was found here
Nor does it use the parsing library
Directly extracted out
This is not actually part of this project
But just did it
Just put it out together
The result is all the song titles and IDs in the playlist
This side also found an interface
Then extract it
and parse
Finally save as txt text
There's nothing to say about this
You can refer to the previous Douban comment word cloud map blog