Recently, I saw many blogs posting tutorials on web page packet capture, which aroused my interest (zhuang) and (bi), and this article was born. It just happened that some time ago, the API for My Playlist to connect to Kugou failed. I took the opportunity to fix it and make a graphic tutorial. Then let Kugou “operate” About the concept of packet capture
Packet capture is to intercept, resend, edit, and dump the data packets sent and received during network transmission. It is also used to check network security. Packet capture is also often used for data interception, etc.
——From Gay Encyclopedia
What we are talking about here is the interception of data transmitted by web pages, and does not involve operations such as resending and editing that affect network security.
In fact, I have published many articles about packet capture as early as 2016. However, due to the disrepair of the articles, the pictures are missing, broken, and the order is completely messed up.
Packet capture may be unfamiliar to people who do WEB development, especially the backend, but I come from a desktop application background, so I feel comfortable using it.
Purpose:
Analyze direct links to Kugou songs - Repair my playlist
Target website:
http://t.kugou.com/1md5hf5t8V2 Kugou My Playlist Sharing Short URL
Tools used:
Google Chrome F12 (or Ctrl + Shift + I, or directly right-click > Inspect element) to develop developer tools
(Please note that the following tutorials should be combined with the pictures. If you cannot see clearly, right-click the picture to open a new window)
Then what I captured here is the mobile version page, because the entire playlist list of the computer version is directly returned to the source code, which is not convenient for us to parse. The mobile version returns json
Preserve Log: The function is to preserve the previous log after the page jumps.
Mobile phone logo in the upper left corner: Switch the UA of the current browsing interface to mobile UA
Enter the URL and press Enter to access, and the webpage will jump.
Status code 302, get the redirection address (be sure to look at the picture, the text description is simplified)
The packet capture ends here, let’s start the analysis:
What is certain is that the music link on the Kugou website is definitely not fixed.
From past experience, these are suspicious parameters.
Search in the packet capture log to get the list of methods for obtaining the entire playlist. and contains basic information about the song
Analyzing the list link, it is obvious that the parameters here are very similar to the previous ones.
The next step is to analyze the link of each song
The validity period of the song direct link is about 24 hours, and then it will expire.
Continue to view the packet capture log
Bring the hash value of the song to get relevant information and direct links to the song (the hash value has been returned in the previous song list)

Summarize:
Short URL -> Web link parameters -> Get playlist list -> Get songs (step by step, bring the parameters obtained in the previous step to visit the next URL)
Remove the relevant code yourself…-. -
It’s been a long time since I posted such a tutorial article.
Finally, Google developer tools are really useful!
A wave of water, escape~~
Related recommendations (1) Use PHP to grab Bing’s daily images and use them for your own use. Meng Kun’s blog. (2) Introduction to packet capture (1) Related code (1) Kugou Playlist’s interface source code for obtaining song information