Hi there
desperadoj.com

UnblockNeteaseMusic 使用方法

简介

UnblockNeteaseMusic 是一个解锁网易云音乐已下架歌曲的开源项目。

使用方法

下文的使用方法均基于 CentOS 7。

基本用法

安装 Node.js 和 PM2

curl -sL https://rpm.nodesource.com/setup_10.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

修改 hook.js

vim hook.js

找到如下代码

hook.target.host = [
    'music.163.com',
    'interface.music.163.com',
    'interface3.music.163.com',
    'apm.music.163.com',
    'apm3.music.163.com',
    // 'mam.netease.com',
    // 'api.iplay.163.com', // look living
    // 'ac.dun.163yun.com',
    // 'crash.163.com',
    // 'clientlog.music.163.com',
    // 'clientlog3.music.163.com'
]

修改为以下内容并保存

hook.target.host = [
    'music.163.com',
    'interface.music.163.com',
    'interface3.music.163.com',
    'api.iplay.163.com',
    'apm.music.163.com',
    'apm3.music.163.com',
    '39.105.63.80',
    '45.254.48.1',
    '47.100.127.239',
    '59.111.160.195',
    '59.111.160.197',
    '59.111.181.35',
    '59.111.181.38',
    '59.111.181.60',
    '101.71.154.241',
    '103.126.92.132',
    '103.126.92.133',
    '112.13.119.17',
    '112.13.122.1',
    '115.236.118.33',
    '115.236.121.1',
    '118.24.63.156',
    '193.112.159.225',
    '223.252.199.66',
    '223.252.199.67'
]

运行 UnblockNeteaseMusic

#iOS
pm2 start app.js --name="ios" -- -s -p port1:port2 -o kuwo qq -e https://music.163.com
#非 iOS
pm2 start app.js --name="general" -- -s -p port1:port2 -o kuwo qq
#保存进程
pm2 save
#设置开机启动
pm2 startup

说明:

  1. 端口 -p port1:port2 和音源 -o kuwo qq 请根据自己需求修改。
  2. 由于新版网易云音乐 iOS 客户端会强制检测音源是否为 HTTPS,所以要对 iOS 与非 iOS 分开进行配置。
  3. 由于 JOOX 默认为 HTTPS,若服务器可使用 JOOX 音源,将 JOOX 设为默认音源可以同时适用 iOS 端与非 iOS端:
    pm2 start app.js --name="general" -- -s -p port1:port2 -o joox
  4. 若部署在公网服务器上,强烈推荐使用 -s 参数开启严格模式,限制代理范围为仅网易云音乐解锁所需域名和 IP,防止被滥用盗用。
  5. 端口部分 -p port1:port2 的写法参考 这里
  6. 目前已知的使用 PAC 模式的 BUG 为:手机微博客户端无法刷出内容,原因不明。

在系统代理填入以下地址,iOS 需下载安装并信任 证书,Windows 需将网易云音乐客户端设置为「使用 IE 代理设置」。

http://server:port1/proxy.pac

音源选择

目前所有可选用的音源如下表

参数 音源 音质 描述
baidu 百度音乐 128kbps 曲库很少,不推荐使用
joox JOOX 音乐 320kbps 腾讯国际产品,曲库一般,少于 QQ 音乐,仅限 香港,澳门,泰国,印尼,马来西亚,缅甸,南非 IP
kugou 酷狗音乐 320kbps 曲库很少,不推荐使用
kuwo 酷我音乐 320kbps 曲库全,仅限大陆 IP
migu 咪咕音乐 320kbps 曲库一般,对 IP 无限制
qq QQ 音乐 128kbps 曲库全,对 IP 无限制
xiami 虾米音乐 / 搜索接口被拦截要求移动滑块验证,目前不可用
  • 匹配准确度

经测试,kuwo>qq>migu≈joox

  • 推荐参数

大陆 IP:-o kuwo qq migu

非大陆 IP:-o qq migu joox

转发为 Shadowsocks

glider 是一个支持多种协议的代理转发软件。UnblockNeteaseMusic 只能提供 HTTP 代理,由于使用严格模式,需将代理进行分流,使用 glider 将 HTTP 转发为 Shadowsocks 协议后,适用的客户端更多,且由于使用分流代理,上文所述手机微博客户端无法刷出内容的 BUG 也不复存在。

服务端部署 glider

下载 glider

wget -N --no-check-certificate https://github.com/nadoo/glider/releases/download/v0.9.2/glider_0.9.2_linux_amd64.tar.gz

解压

tar zxvf glider_0.9.2_linux_amd64.tar.gz && cd glider_0.9.2_linux_amd64

复制二进制文件

cp glider /usr/bin/ && chmod +x /usr/bin/glider

创建配置文件,以 iOS 为例

mkdir /etc/glider/ && vim /etc/glider/ios-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:[email protected]:port

#需转发的上游 UnblockNeteaseMusic HTTP 代理
forward=http://127.0.0.1:port1

通过 systemd 创建开机启动

vim /etc/systemd/system/glider-ios.service

写入以下内容并保存

[Unit]
Description=Glider iOS Shadowsocks Service
After=network.target iptables.service ip6tables.service

[Service]
Type=simple
PIDFile=/var/run/glider-ios.pid
Restart=on-failure
LimitNOFILE=102400

# NOTE: change to your glider path
ExecStart=/usr/bin/glider -config /etc/glider/ios-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-ios.service

systemctl enable glider-ios.service

启动 glider-ios.service

systemctl start glider-ios.service

查看 glider-ios.service 状态

systemctl status glider-ios.service

客户端分流规则

以下规则均为 解锁网易云音乐+屏蔽客户端广告,其中服务器地址,端口,加密方式及密码需进行修改。

  • 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: AES-128-GCM, password: "password" }

Proxy Group:
- { name: "Netease Music", type: select, proxies: [ "Unblock", "DIRECT" ] }

Rule:
# Unblock 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

# 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
  • Quantumult
[SERVER]

[SOURCE]

[BACKUP-SERVER]

[SUSPEND-SSID]

[POLICY]

[DNS]
119.29.29.29, 223.5.5.5, 1.2.4.8, system

[REWRITE]

[URL-REJECTION]

[TCP]
# Unblock Netease Music
HOST,api.iplay.163.com,Unblock Netease Music
HOST,apm3.music.163.com,Unblock Netease Music
HOST,apm.music.163.com,Unblock Netease Music
HOST,interface3.music.163.com,Unblock Netease Music
HOST,interface.music.163.com,Unblock Netease Music
HOST,music.163.com,Unblock Netease Music
IP-CIDR,39.105.63.80/32,Unblock Netease Music
IP-CIDR,45.254.48.1/32,Unblock Netease Music
IP-CIDR,47.100.127.239/32,Unblock Netease Music
IP-CIDR,59.111.160.195/32,Unblock Netease Music
IP-CIDR,59.111.160.197/32,Unblock Netease Music
IP-CIDR,59.111.181.35/32,Unblock Netease Music
IP-CIDR,59.111.181.38/32,Unblock Netease Music
IP-CIDR,59.111.181.60/32,Unblock Netease Music
IP-CIDR,101.71.154.241/32,Unblock Netease Music
IP-CIDR,103.126.92.132/32,Unblock Netease Music
IP-CIDR,103.126.92.133/32,Unblock Netease Music
IP-CIDR,112.13.119.17/32,Unblock Netease Music
IP-CIDR,112.13.122.1/32,Unblock Netease Music
IP-CIDR,115.236.118.33/32,Unblock Netease Music
IP-CIDR,115.236.121.1/32,Unblock Netease Music
IP-CIDR,118.24.63.156/32,Unblock Netease Music
IP-CIDR,193.112.159.225/32,Unblock Netease Music
IP-CIDR,223.252.199.66/32,Unblock Netease Music
IP-CIDR,223.252.199.67/32,Unblock 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]
# Unblock Netease Music
DOMAIN,api.iplay.163.com,Unblock Netease Music
DOMAIN,apm3.music.163.com,Unblock Netease Music
DOMAIN,apm.music.163.com,Unblock Netease Music
DOMAIN,interface3.music.163.com,Unblock Netease Music
DOMAIN,interface.music.163.com,Unblock Netease Music
DOMAIN,music.163.com,Unblock Netease Music
IP-CIDR,39.105.63.80/32,Unblock Netease Music
IP-CIDR,45.254.48.1/32,Unblock Netease Music
IP-CIDR,47.100.127.239/32,Unblock Netease Music
IP-CIDR,59.111.160.195/32,Unblock Netease Music
IP-CIDR,59.111.160.197/32,Unblock Netease Music
IP-CIDR,59.111.181.35/32,Unblock Netease Music
IP-CIDR,59.111.181.38/32,Unblock Netease Music
IP-CIDR,59.111.181.60/32,Unblock Netease Music
IP-CIDR,101.71.154.241/32,Unblock Netease Music
IP-CIDR,103.126.92.132/32,Unblock Netease Music
IP-CIDR,103.126.92.133/32,Unblock Netease Music
IP-CIDR,112.13.119.17/32,Unblock Netease Music
IP-CIDR,112.13.122.1/32,Unblock Netease Music
IP-CIDR,115.236.118.33/32,Unblock Netease Music
IP-CIDR,115.236.121.1/32,Unblock Netease Music
IP-CIDR,118.24.63.156/32,Unblock Netease Music
IP-CIDR,193.112.159.225/32,Unblock Netease Music
IP-CIDR,223.252.199.66/32,Unblock Netease Music
IP-CIDR,223.252.199.67/32,Unblock 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
  • 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
ipv6 = false

[Proxy]
Unblock = ss, server, port, aes-128-gcm, password

[Proxy Group]
Netease Music = select, Unblock, DIRECT

[Rule]
# Unblock Netease 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

# 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
赞(4) 打赏
本文采用 CC BY-NC 4.0 进行许可,转载请注明出处:如风 » UnblockNeteaseMusic 使用方法
分享到: 更多 (0)

评论 3

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    试了下,想弄一个ios和非ios同时可用,但是iOS成功看,非ios失败,不清楚哪里错了

    danchawiPad | Safari 604.1 | 2个月前 (12-27)回复
    • 是下面这样设置的吗?iOS 和非 iOS 共用,音源只能选 JOOX
      pm2 start app.js --name="general" -- -s -p port1:port2 -o joox

      DesperadoJWindows 10 | Chrome 79.0.3945.88 | 2个月前 (12-27)回复
      • 谢谢,我去试试

        danchawiPad | Safari 604.1 | 2个月前 (12-27)回复

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏