How to use Python web crawler to crawl NetEase cloud music songs

Today, the editor will take you to use Python to crawl NetEase Cloud Music, and download the music on the website to the local in minutes.

The bobbins who have run the code with the editor are no longer talking about grabbing the lyrics of NetEase Cloud. When grabbing the lyrics, two parameters, the singer ID and the song name are passed in the function. In fact, the same is true for crawling songs. The truth is that these two parameters also need to be passed in, but the URL of NetEase cloud songs is generally not found. But don't panic, there is a small editor here to clear your troubles in minutes.

Netease cloud songs generally have an external link, which is specially used to download music audio. Taking Zhao Lei's song "Chengdu" as an example, the external link URL of "Chengdu" is:

http://music.163.com/song/media/outer/url?id=436514312.mp3, the number 436514312 is the ID of the song "Chengdu". That is to say, as long as we pass the ID of the song into the external link URL, we can find the download address of the song, and then download it through the Python standard library.

Not much to say, go directly to the code:

How to use Python web crawler to crawl NetEase cloud music songs

After the program is designed, run the program and enter the singer's ID. Taking Zhao Lei as an example, his ID is 6731. After entering this ID value, the program will automatically download Zhao Lei's album songs and their corresponding lyrics to the local, and run the program. The effect diagram is as follows:

How to use Python web crawler to crawl NetEase cloud music songs

After the program runs, the lyrics and songs are all down to the local, as shown below:

How to use Python web crawler to crawl NetEase cloud music songs

How to use Python web crawler to crawl NetEase cloud music songs

After that, you can listen to elegant songs locally, such as "Chengdu", see the picture below:

How to use Python web crawler to crawl NetEase cloud music songs

If you want to listen to songs in the future, just run this crawler program, enter the ID of the singer you like, wait for a while, and then you can hear the songs you want~~~ 100,000 songs are not a problem, as long as You can travel in as many capitals as you want~~

Finally, I wish everyone good health and smooth work~~ Welcome to reprint

For the complete code screenshot of this program today, you can refer to the article that Xiaobian shared based on Python NetEase Cloud Music Lyric Crawling . Combined with today's code, you can get your wish~~~

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325011491&siteId=291194637