包含标签 requests 的文章

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.

Python implementation for Qianqian Music MP3 download

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:

Python implementation for Qianqian Music MP3 download

Check the request details:

Python implementation for Qianqian Music MP3 download 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.

……

阅读全文

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.

Python implementation for Qianqian Music MP3 download

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:

Python implementation for Qianqian Music MP3 download Check the request details:

Python implementation for Qianqian Music MP3 download

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.

……

阅读全文

python3 requests module usage examples

The network module in python3 is much more convenient compared to python2. The requests package combines several python2 packages. This article explains the usage of requests with examples, serving as a review and future reference.……

阅读全文

Recursively download files python

I want to back up my website recently, but the size of the file downloaded by PHP is limited, and I am too lazy to install FTP to download it. So I thought of temporarily setting up a secondary domain name site, and then using python (python3)’s requests library to directly download all the files and folders in the root directory of the website to achieve the purpose of backup.……

阅读全文