One trick to teach you how to download music or resource files from web pages

Portal: Music Appreciation

1. After searching for the song, listen to it first

Insert image description here

2.F12 open the browser developer tools, select network, and check media

Insert image description here

3. Copy the code

If you are on a Windows system: point the mouse at the file, right-click, copy, and copy in PowerShell format

Open powershell and add suffix:

-OutFile ‘E:/download.mp3’

//As shown below
Insert image description here

//The complete code is as follows:

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
>> $session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
>> Invoke-WebRequest -UseBasicParsing -Uri "https://mp3.haoge500.com/upload/128/2017/09/20/868202.mp3" `
>> -WebSession $session `
>> -Headers @{
    
    
>> "authority"="mp3.haoge500.com"
>>   "method"="GET"
>>   "path"="/upload/128/2017/09/20/868202.mp3"
>>   "scheme"="https"
>>   "accept"="*/*"
>>   "accept-encoding"="identity;q=1, *;q=0"
>>   "accept-language"="zh-CN,zh;q=0.9"
>>   "referer"="https://www.zz123.com/"
>>   "sec-ch-ua"="`"Not_A Brand`";v=`"99`", `"Google Chrome`";v=`"109`", `"Chromium`";v=`"109`""
>>   "sec-ch-ua-mobile"="?0"
>>   "sec-ch-ua-platform"="`"Windows`""
>>   "sec-fetch-dest"="audio"
>>   "sec-fetch-mode"="no-cors"
>>   "sec-fetch-site"="cross-site"
>> } -OutFile ‘E:/download.mp3’

After completion, go to the E drive to find it. If you don’t have an E drive, change the code to another drive.

Mac or Linux users: point the mouse at the file, right-click, copy, and copy in cURL format

After copying it to your command line, add -O at the end

//The complete code is as follows:

curl 'https://freetyst.nf.migu.cn/public/product9th/product45/2022/05/0716/2009%E5%B9%B406%E6%9C%8826%E6%97%A5%E5%8D%9A%E5%B0%94%E6%99%AE%E6%96%AF/%E6%A0%87%E6%B8%85%E9%AB%98%E6%B8%85/MP3_320_16_Stero/60054701942164749.mp3' \
  -H 'Accept: */*' \
  -H 'Accept-Language: zh-CN,zh;q=0.9' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Range: bytes=0-' \
  -H 'Referer: https://zz123.com/' \
  -H 'Sec-Fetch-Dest: audio' \
  -H 'Sec-Fetch-Mode: no-cors' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  --compressed -O

Open the downloaded file on any of your music players and listen~

おすすめ

転載: blog.csdn.net/qq_42183962/article/details/129002201
おすすめ