Python implementation for Qianqian Music MP3 download
Entering the Qianqian Music homepage and selecting Jay Chou’s “Confession Balloon” reveals that it’s a 2016 song with no preview available, which is sad. Is there a way to get the MP3 file? The answer is yes. A runnable program for music download is available at the end of the article.
Without further ado, I opened the charts and chose a new song that could be previewed; “Sheng Pi Zi” was the first one I could listen to.
1. Analyze API information
Opening the developer tools, I found that music files are definitely submitted through an API. Among many requests, I found a request that could retrieve music files. See the image below:
Check the request details:
The songid parameter can be found in the current URL:
http://music.taihe.com/song/611238837
. It’s simple. from
should be “web” or “app”, etc. The format
defining the return data type doesn’t need to be changed. method
doesn’t need to be changed. The _
parameter is a 13-digit timestamp. callback
is the prefix of the returned JSON data. The 1546915161467
after the underscore is a 13-digit timestamp, while the preceding 17200943498528136486
is unknown. We’ll try to use the known parameters to see if we can retrieve information without changing the unknown content.