Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Unblock163Music-resty
upstream music163com {
least_conn;
keepalive 10;
#server 14.215.9.16:80;
#server 219.138.27.67:80;
server music.163.com:80;
}
server{
listen 80;
server_name music.163.com;
set $download_bitrate "320000";
set $playback_bitrate "320000";
location / {
proxy_set_header Host $http_host;
proxy_pass http://music163com;
proxy_send_timeout 5s;
}
location ~ /eapi/(v3/song/detail/|v1/album/|v3/playlist/detail|batch|cloudsearch/pc|v1/artist|v1/search/get) {
proxy_set_header Host $http_host;
proxy_pass http://music163com;
proxy_send_timeout 5s;
proxy_set_header Accept-Encoding "";
header_filter_by_lua 'ngx.header.content_length = nil';
body_filter_by_lua '
local chunk = ngx.arg[1]
local n, e
chunk, n, e = ngx.re.gsub(chunk, [[\\"pl\\":\\d+]], "\\"pl\\":" .. ngx.var.playback_bitrate)
chunk, n, e = ngx.re.gsub(chunk, [[\\"dl\\":\\d+]], "\\"dl\\":" .. ngx.var.download_bitrate)
chunk, n, e = ngx.re.gsub(chunk, [[\\"st\\":-?\\d+]], "\\"st\\":0")
chunk, n, e = ngx.re.gsub(chunk, [[\\"subp\":\\d+]], "\\"subp\\":1")
ngx.arg[1] = chunk
';
}
location = /eapi/song/download/limit {
echo "{\"overflow\":false,\"code\":200}";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment