简介
UnblockNeteaseMusic 是一个解锁网易云音乐已下架歌曲的开源项目。
使用方法
下文的使用方法均基于 CentOS 7。
基本用法
安装 Node.js 和 PM2
curl -sL https://rpm.nodesource.com/setup_12.x | bash - yum install nodejs -y npm install pm2 -g
下载 UnblockNeteaseMusic
git clone https://github.com/nondanee/UnblockNeteaseMusic.git && cd UnblockNeteaseMusic
UnblockNeteaseMusic 的配置参数如下:
$ unblockneteasemusic -h usage: unblockneteasemusic [-v] [-p port] [-a address] [-u url] [-f host] [-o source [source ...]] [-t token] [-e url] [-s] [-h] optional arguments: -v, --version output the version number -p port, --port port specify server port -a address, --address address specify server host -u url, --proxy-url url request through upstream proxy -f host, --force-host host force the netease server ip -o source [source ...], --match-order source [source ...] set priority of sources -t token, --token token set up proxy authentication -e url, --endpoint url replace virtual endpoint with public host -s, --strict enable proxy limitation -h, --help output usage information
运行 UnblockNeteaseMusic
# macOS, iOS, Linux pm2 start app.js --name="https_endpoit" -- -s -p port1:port2 -o kuwo qq migu -e https://music.163.com # Windows, Android pm2 start app.js --name="http_endpoit" -- -s -p port1:port2 -o kuwo qq migu # 保存进程 pm2 save # 设置开机启动 pm2 startup
说明:
- 端口
-p port1:port2
和音源-o kuwo qq migu
请根据自己需求修改。 - 由于新版 macOS / iOS / Linux 网易云音乐客户端强制检测音源是否为 HTTPS 路径,所以要对 macOS / iOS / Linux 与 Windows / Android 分开进行配置。
- 由于 JOOX 音源默认为 HTTPS 路径,若服务器可使用 JOOX 音源,将 JOOX 设为默认音源可以同时适用所有客户端:
pm2 start app.js --name="general" -- -s -p port1:port2 -o joox
- 若部署在公网服务器上,强烈推荐使用
-s
参数开启严格模式,限制代理范围为仅网易云音乐解锁所需域名和 IP,防止被滥用盗用。 - 端口部分
-p port1:port2
的写法参考 这里。 目前已知的使用 PAC 模式的 BUG 为:手机微博客户端无法刷出内容,原因不明。(已修复)
在系统代理填入以下地址,macOS / iOS / Linux 均需下载安装并信任 证书,Linux 启动客户端还需要增加 --ignore-certificate-errors
参数;Windows 需将网易云音乐客户端设置为「使用 IE 代理设置」。
音源选择
目前所有可选用的音源如下表
参数 | 音源 | 音质 | 描述 |
---|---|---|---|
baidu | 百度音乐 | 128kbps | 曲库很少,不推荐使用 |
joox | JOOX 音乐 | 320kbps | 腾讯国际产品,曲库一般,仅限 香港,澳门,泰国,印尼,马来西亚,缅甸,南非 IP |
kugou | 酷狗音乐 | 128kbps | 曲库很少,不推荐使用 |
kuwo | 酷我音乐 | 320kbps | 曲库全,对 IP 无限制 |
migu | 咪咕音乐 | 320kbps | 曲库一般,仅限大陆 IP |
QQ 音乐 | 128kbps | 曲库一般,仅限大陆 IP | |
xiami | 虾米音乐 | / | 搜索接口被拦截要求移动滑块验证,目前不可用 |
- 匹配准确度
经测试,kuwo>qq>migu≈joox
- 推荐参数
大陆 IP:-o kuwo qq migu
非大陆 IP:-o kuwo joox
转发为 Shadowsocks
glider 是一个支持多种协议的代理转发软件。UnblockNeteaseMusic 只能提供 HTTP 代理,由于使用严格模式,需将代理进行分流,使用 glider 将 HTTP 转发为 Shadowsocks 协议后,适用的客户端也更加丰富。
服务端部署 glider
下载 glider
wget -N --no-check-certificate https://github.com/nadoo/glider/releases/download/v0.9.3/glider_0.9.3_linux_amd64.tar.gz
解压
tar zxvf glider_0.9.3_linux_amd64.tar.gz && cd glider_0.9.3_linux_amd64
复制二进制文件
cp glider /usr/bin/ && chmod +x /usr/bin/glider
创建配置文件,以适用于 macOS / iOS / Linux 为例
mkdir /etc/glider/ && vim /etc/glider/https-ss.conf
写入以下内容并保存,需自行修改加密方式 method
,密码 password
,Shadowsocks 监听的端口 port
及 UnblockNeteaseMusic 监听的端口 port1
。
# 开启调试模式,输出log verbose=True # Shadowsocks: # Method: # AEAD Ciphers: # AEAD_AES_128_GCM AEAD_AES_192_GCM AEAD_AES_256_GCM AEAD_CHACHA20_POLY1305 AEAD_XCHACHA20_POLY1305 # Stream Ciphers: # AES-128-CFB AES-128-CTR AES-192-CFB AES-192-CTR AES-256-CFB AES-256-CTR CHACHA20-IETF XCHACHA20 CHACHA20 RC4-MD5 # Alias: # chacha20-ietf-poly1305 = AEAD_CHACHA20_POLY1305, xchacha20-ietf-poly1305 = AEAD_XCHACHA20_POLY1305 listen=ss://method:password@:port # 需转发的 UnblockNeteaseMusic HTTP 代理 forward=http://127.0.0.1:port1
通过 systemd 创建开机启动
vim /etc/systemd/system/glider-https-ss.service
写入以下内容并保存
[Unit] Description=Glider UnblockNeteaseMusic Shadowsocks Service for macOS, iOS, Linux After=network.target nss-lookup.target [Service] Type=simple Restart=on-failure LimitNOFILE=102400 CPUAccounting=yes MemoryAccounting=yes # NOTE: change to your glider path ExecStart=/usr/bin/glider -config /etc/glider/https-ss.conf # work with systemd v229 or later, so glider can listen on port below 1024 with none-root user # CAP_NET_ADMIN: ipset # CAP_NET_BIND_SERVICE: bind ports under 1024 CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE NoNewPrivileges=true [Install] WantedBy=multi-user.target
启用 glider-https-ss.service
systemctl enable glider-https-ss.service
启动 glider-https-ss.service
systemctl start glider-https-ss.service
查看 glider-https-ss.service 状态
systemctl status glider-https-ss.service
客户端分流规则
以下规则均为 解锁网易云音乐+屏蔽客户端广告,其中服务器地址 server
,端口 server
,加密方式 cipher
及 密码 password
需自行修改。
- Clash
port: 7890 socks-port: 7891 allow-lan: false mode: Rule log-level: info external-controller: 127.0.0.1:9090 dns: enable: true listen: 0.0.0.0:53 enhanced-mode: fake-ip nameserver: - 119.29.29.29 - 223.5.5.5 Proxy: - name: Unblock type: ss server: server port: port cipher: cipher password: password Proxy Group: - name: Netease Music type: select proxies: - Unblock - DIRECT Rule: # Netease Music - DOMAIN,api.iplay.163.com,Netease Music - DOMAIN,apm3.music.163.com,Netease Music - DOMAIN,apm.music.163.com,Netease Music - DOMAIN,interface3.music.163.com,Netease Music - DOMAIN,interface.music.163.com,Netease Music - DOMAIN,music.163.com,Netease Music - IP-CIDR,39.105.63.80/32,Netease Music - IP-CIDR,45.254.48.1/32,Netease Music - IP-CIDR,47.100.127.239/32,Netease Music - IP-CIDR,59.111.160.195/32,Netease Music - IP-CIDR,59.111.160.197/32,Netease Music - IP-CIDR,59.111.181.35/32,Netease Music - IP-CIDR,59.111.181.38/32,Netease Music - IP-CIDR,59.111.181.60/32,Netease Music - IP-CIDR,101.71.154.241/32,Netease Music - IP-CIDR,103.126.92.132/32,Netease Music - IP-CIDR,103.126.92.133/32,Netease Music - IP-CIDR,112.13.119.17/32,Netease Music - IP-CIDR,112.13.122.1/32,Netease Music - IP-CIDR,115.236.118.33/32,Netease Music - IP-CIDR,115.236.121.1/32,Netease Music - IP-CIDR,118.24.63.156/32,Netease Music - IP-CIDR,193.112.159.225/32,Netease Music - IP-CIDR,223.252.199.66/32,Netease Music - IP-CIDR,223.252.199.67/32,Netease Music # Netease Music Advertising - DOMAIN,admusicpic.music.126.net,REJECT - DOMAIN,iadmat.nosdn.127.net,REJECT - DOMAIN,iadmusicmat.music.126.net,REJECT - DOMAIN,iadmusicmatvideo.music.126.net,REJECT # Final - MATCH,DIRECT
- Surfboard
[General] skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local dns-server = 119.29.29.29, 223.5.5.5, 1.2.4.8, system [Proxy] Unblock = ss, server, port, cipher, password, udp-relay=false [Proxy Group] Netease Music = select, Unblock, DIRECT [Rule] # Netease Music DOMAIN,api.iplay.163.com,Netease Music DOMAIN,apm3.music.163.com,Netease Music DOMAIN,apm.music.163.com,Netease Music DOMAIN,interface3.music.163.com,Netease Music DOMAIN,interface.music.163.com,Netease Music DOMAIN,music.163.com,Netease Music IP-CIDR,39.105.63.80/32,Netease Music IP-CIDR,45.254.48.1/32,Netease Music IP-CIDR,47.100.127.239/32,Netease Music IP-CIDR,59.111.160.195/32,Netease Music IP-CIDR,59.111.160.197/32,Netease Music IP-CIDR,59.111.181.35/32,Netease Music IP-CIDR,59.111.181.38/32,Netease Music IP-CIDR,59.111.181.60/32,Netease Music IP-CIDR,101.71.154.241/32,Netease Music IP-CIDR,103.126.92.132/32,Netease Music IP-CIDR,103.126.92.133/32,Netease Music IP-CIDR,112.13.119.17/32,Netease Music IP-CIDR,112.13.122.1/32,Netease Music IP-CIDR,115.236.118.33/32,Netease Music IP-CIDR,115.236.121.1/32,Netease Music IP-CIDR,118.24.63.156/32,Netease Music IP-CIDR,193.112.159.225/32,Netease Music IP-CIDR,223.252.199.66/32,Netease Music IP-CIDR,223.252.199.67/32,Netease Music # Netease Music Advertising DOMAIN,admusicpic.music.126.net,REJECT DOMAIN,iadmat.nosdn.127.net,REJECT DOMAIN,iadmusicmat.music.126.net,REJECT DOMAIN,iadmusicmatvideo.music.126.net,REJECT # Final FINAL,DIRECT
- Quantumult
[SERVER] Netease Music = shadowsocks, server, port, cipher, "password", upstream-proxy=false, upstream-proxy-auth=false [SOURCE] [BACKUP-SERVER] [SUSPEND-SSID] [POLICY] [DNS] 119.29.29.29, 223.5.5.5, 1.2.4.8, system [REWRITE] [URL-REJECTION] [TCP] # Netease Music HOST,api.iplay.163.com,Netease Music HOST,apm3.music.163.com,Netease Music HOST,apm.music.163.com,Netease Music HOST,interface3.music.163.com,Netease Music HOST,interface.music.163.com,Netease Music HOST,music.163.com,Netease Music IP-CIDR,39.105.63.80/32,Netease Music IP-CIDR,45.254.48.1/32,Netease Music IP-CIDR,47.100.127.239/32,Netease Music IP-CIDR,59.111.160.195/32,Netease Music IP-CIDR,59.111.160.197/32,Netease Music IP-CIDR,59.111.181.35/32,Netease Music IP-CIDR,59.111.181.38/32,Netease Music IP-CIDR,59.111.181.60/32,Netease Music IP-CIDR,101.71.154.241/32,Netease Music IP-CIDR,103.126.92.132/32,Netease Music IP-CIDR,103.126.92.133/32,Netease Music IP-CIDR,112.13.119.17/32,Netease Music IP-CIDR,112.13.122.1/32,Netease Music IP-CIDR,115.236.118.33/32,Netease Music IP-CIDR,115.236.121.1/32,Netease Music IP-CIDR,118.24.63.156/32,Netease Music IP-CIDR,193.112.159.225/32,Netease Music IP-CIDR,223.252.199.66/32,Netease Music IP-CIDR,223.252.199.67/32,Netease Music # Netease Music Advertising HOST,admusicpic.music.126.net,REJECT HOST,iadmat.nosdn.127.net,REJECT HOST,iadmusicmat.music.126.net,REJECT HOST,iadmusicmatvideo.music.126.net,REJECT # Final FINAL,DIRECT [GLOBAL] [HOST] [STATE] STATE,AUTO [MITM]
- Shadowrocket
[General] bypass-system = true skip-proxy = 192.168.0.0/16, 193.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, 127.0.0.1, 17.0.0.0/8, localhost, *.local bypass-tun = 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.2.0/24, 192.88.99.0/24, 192.168.0.0/16, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 224.0.0.0/4, 255.255.255.255/32 dns-server = 119.29.29.29, 223.5.5.5, 1.2.4.8, system [Rule] # Netease Music DOMAIN,api.iplay.163.com,Netease Music DOMAIN,apm3.music.163.com,Netease Music DOMAIN,apm.music.163.com,Netease Music DOMAIN,interface3.music.163.com,Netease Music DOMAIN,interface.music.163.com,Netease Music DOMAIN,music.163.com,Netease Music IP-CIDR,39.105.63.80/32,Netease Music IP-CIDR,45.254.48.1/32,Netease Music IP-CIDR,47.100.127.239/32,Netease Music IP-CIDR,59.111.160.195/32,Netease Music IP-CIDR,59.111.160.197/32,Netease Music IP-CIDR,59.111.181.35/32,Netease Music IP-CIDR,59.111.181.38/32,Netease Music IP-CIDR,59.111.181.60/32,Netease Music IP-CIDR,101.71.154.241/32,Netease Music IP-CIDR,103.126.92.132/32,Netease Music IP-CIDR,103.126.92.133/32,Netease Music IP-CIDR,112.13.119.17/32,Netease Music IP-CIDR,112.13.122.1/32,Netease Music IP-CIDR,115.236.118.33/32,Netease Music IP-CIDR,115.236.121.1/32,Netease Music IP-CIDR,118.24.63.156/32,Netease Music IP-CIDR,193.112.159.225/32,Netease Music IP-CIDR,223.252.199.66/32,Netease Music IP-CIDR,223.252.199.67/32,Netease Music # Netease Music Advertising DOMAIN,admusicpic.music.126.net,REJECT DOMAIN,iadmat.nosdn.127.net,REJECT DOMAIN,iadmusicmat.music.126.net,REJECT DOMAIN,iadmusicmatvideo.music.126.net,REJECT # Final FINAL,DIRECT