UnblockNeteaseMusic 使用方法

简介

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

使用方法

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

基本用法

安装 Node.js 和 PM2

curl -sL https://rpm.nodesource.com/setup_lts.x | bash -
yum install nodejs -y
npm install pm2 -g

下载 UnblockNeteaseMusic

git clone https://github.com/UnblockNeteaseMusic/server.git && cd server

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

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

说明:

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

在系统代理填入 http://server:port1/proxy.pac

  • macOS / iOS / iPadOS 需下载安装并信任 证书
  • Linux 启动客户端需增加 启动参数 --ignore-certificate-errors
  • Windows 需将网易云音乐客户端设置为「使用 IE 代理设置」

音源选择

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

参数音源音质描述
baidu百度音乐128kbps曲库很少,不推荐使用
jooxJOOX 音乐320kbps腾讯国际产品,曲库一般,仅限 香港,澳门,泰国,印尼,马来西亚,缅甸,南非 IP
kugou酷狗音乐128kbps曲库很少,不推荐使用
kuwo酷我音乐320kbps曲库全,对 IP 无限制
migu咪咕音乐320kbps曲库一般,仅限大陆 IP
qqQQ 音乐128kbps曲库一般,仅限大陆 IP

匹配准确度

经测试,kuwo>qq>migu≈joox

推荐参数

大陆 IP:-o kuwo qq migu

非大陆 IP:-o kuwo joox

转发为 Shadowsocks

UnblockNeteaseMusic 只能提供 HTTP 代理,由于使用严格模式,需将代理进行分流,将 HTTP 转发为 Shadowsocks 协议后,适用的客户端也更加丰富。

通过 v2ray 转发为 Shadowsocks

v2ray 是一个时下极为流行、被广泛使用的代理工具。

使用 fhs-install-v2ray 脚本一键安装 v2ray

bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)

修改配置文件

vim /usr/local/etc/v2ray/config.json

写入以下内容并保存,需自行修改加密方式 method,密码 password,Shadowsocks 监听的端口 port 及 UnblockNeteaseMusic 监听的端口 port1

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "port": port,
      "protocol": "shadowsocks",
      "settings": {
        "method": "method",
        "password": "password",
        "network": "tcp"
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "http",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": port1
          }
        ]
      }
    }
  ]
}

重启 v2ray 以应用最新配置文件

systemctl restart v2ray

查看 v2ray 状态

systemctl status v2ray

额外说明

也可转发为 VMess,需自行修改 UUID uuid,密码 password,Shadowsocks 监听的端口 port 及 UnblockNeteaseMusic 监听的端口 port1

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  "inbounds": [
    {
      "port": port,
      "protocol": "vmess",
      "settings": {
        "clients": [
          {
            "id": "uuid"
          }
        ]
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "http",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": port1
          }
        ]
      }
    }
  ]
}

通过 glider 转发为Shadowsocks

glider 是一个支持多种协议的代理转发软件。

下载 glider

wget https://github.com/nadoo/glider/releases/download/v0.16.2/glider_0.16.2_linux_amd64.tar.gz

解压

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

复制二进制文件

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

创建配置文件,以适用于 iOS / iPadOS 为例

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:[email protected]: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 iOS & iPadOS
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 --now glider-https-ss.service

查看 glider-https-ss.service 状态

systemctl status glider-https-ss.service

客户端分流规则

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

Clash
mixed-port: 7890
allow-lan: false
mode: rule
log-level: info
external-controller: 127.0.0.1:9090
dns:
  enable: true
  listen: 0.0.0.0:5353
  enhanced-mode: fake-ip
  nameserver:
    - 119.29.29.29
    - 223.5.5.5

proxies:
  - name: Unblock
    type: ss
    server: server
    port: port
    cipher: cipher
    password: password

proxy-groups:
  - name: Netease Music
    type: select
    proxies:
      - Unblock
      - DIRECT

rules:
  # 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

  # Netease Music
  - DOMAIN,apm3.music.163.com,Unblock
  - DOMAIN,apm.music.163.com,Unblock
  - DOMAIN,interface3.music.163.com,Unblock
  - DOMAIN,interface.music.163.com,Unblock
  - DOMAIN,music.163.com,Unblock
  - IP-CIDR,39.105.63.80/32,Unblock,no-resolve
  - IP-CIDR,39.105.175.128/32,Unblock,no-resolve
  - IP-CIDR,47.100.127.239/32,Unblock,no-resolve
  - IP-CIDR,59.111.19.33/32,Unblock,no-resolve
  - IP-CIDR,59.111.160.195/32,Unblock,no-resolve
  - IP-CIDR,59.111.160.197/32,Unblock,no-resolve
  - IP-CIDR,103.126.92.132/32,Unblock,no-resolve
  - IP-CIDR,103.126.92.133/32,Unblock,no-resolve
  - IP-CIDR,112.13.119.18/32,Unblock,no-resolve
  - IP-CIDR,112.13.122.4/32,Unblock,no-resolve
  - IP-CIDR,115.236.118.34/32,Unblock,no-resolve
  - IP-CIDR,115.236.121.4/32,Unblock,no-resolve
  - IP-CIDR,118.24.63.156/32,Unblock,no-resolve
  - IP-CIDR,182.92.170.253/32,Unblock,no-resolve
  - IP-CIDR,193.112.159.225/32,Unblock,no-resolve

  # 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 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

# 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,39.105.175.128/32,Netease Music
IP-CIDR,47.100.127.239/32,Netease Music
IP-CIDR,59.111.19.33/32,Netease Music
IP-CIDR,59.111.160.195/32,Netease Music
IP-CIDR,59.111.160.197/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.18/32,Netease Music
IP-CIDR,112.13.122.4/32,Netease Music
IP-CIDR,115.236.118.34/32,Netease Music
IP-CIDR,115.236.121.4/32,Netease Music
IP-CIDR,118.24.63.156/32,Netease Music
IP-CIDR,182.92.170.253/32,Netease Music
IP-CIDR,193.112.159.225/32,Netease Music

# 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 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

# 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,39.105.175.128/32,Netease Music
IP-CIDR,47.100.127.239/32,Netease Music
IP-CIDR,59.111.19.33/32,Netease Music
IP-CIDR,59.111.160.195/32,Netease Music
IP-CIDR,59.111.160.197/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.18/32,Netease Music
IP-CIDR,112.13.122.4/32,Netease Music
IP-CIDR,115.236.118.34/32,Netease Music
IP-CIDR,115.236.121.4/32,Netease Music
IP-CIDR,118.24.63.156/32,Netease Music
IP-CIDR,182.92.170.253/32,Netease Music
IP-CIDR,193.112.159.225/32,Netease Music

# 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 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

# 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,39.105.175.128/32,Netease Music
IP-CIDR,47.100.127.239/32,Netease Music
IP-CIDR,59.111.19.33/32,Netease Music
IP-CIDR,59.111.160.195/32,Netease Music
IP-CIDR,59.111.160.197/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.18/32,Netease Music
IP-CIDR,112.13.122.4/32,Netease Music
IP-CIDR,115.236.118.34/32,Netease Music
IP-CIDR,115.236.121.4/32,Netease Music
IP-CIDR,118.24.63.156/32,Netease Music
IP-CIDR,182.92.170.253/32,Netease Music
IP-CIDR,193.112.159.225/32,Netease Music

# Final
FINAL,DIRECT

评论

  1. 小有名气的男士
    Chrome 97.0.4692.99
    已编辑
    8月前
    2022-2-02 20:13:16

    你好,我想请教一下。我在群辉nas上布置了这个项目并映射到公网上,为啥点选歌曲的响应速度没您的公益节点快呢?(每点一首歌要反应半分钟)使用方式为docker+glider映射。但是在内网环境中使用内网地址192.168.+端口响应就比较快。这个是否和自己的公网上传速度有关?用的是ios+quantumltX。折腾的好多天,实在是找不到原因了

    • DesperadoJ
      博主
      小有名气的男士
      UC Browser 12.1.4.994
      8月前
      2022-2-02 20:25:39

      应该跟网络环境有关系

  2. 1111
    Chrome 102.0.0.0
    3月前
    2022-6-15 18:48:54

    大佬可以加私人号吗?自己在一台机上搭建不成功,换另一台鸡就搭建成功了,求助

  3. hc
    Chrome 103.0.0.0
    3月前
    2022-7-12 14:46:11

    博主,你好,
    请教一下,已参考博客,在服务器上搭建好了UnblockNeteaseMusic,win上面的网易云也可以使用
    v2ray+shadowsocks也搭建好了,clash选择直连和全局模式都可以连接成功,但是安卓手机还是无法听付费歌曲,灰色歌单也无法打开
    这个问题还是我在安装过程中,出错了吗? 还是现在网易安卓版本无法使用此方法呢?
    如果可行的话,可以帮忙排错,或者安装么,有偿指导;
    我的邮箱是:[email protected]

    • DesperadoJ
      博主
      hc
      Edge 103.0.1264.49
      3月前
      2022-7-12 16:12:32

      Clash for Android 需要在 “设置 – 覆写 – DNS – 策略” 中选择 “不修改”。网易云音乐版本需降级到 8.7.51 及以下版本

      • hc
        DesperadoJ
        Chrome 103.0.0.0
        3月前
        2022-7-12 16:40:50

        博主,你好
        恢复了快照,又重新部署了一次,网易app降级8.5.71,不修改dns之后,还是无法播放付费和灰色歌单,,,请问可以加一下qq 沟通指导一下吗?
        我的qq和邮箱[email protected]

  4. sunnas
    Chrome 96.0.4664.104
    3周前
    2022-9-05 10:49:09

    大佬,可否做成docker镜像啊,搞了好几天。各种问题。卡在这里进行下不去了
    FROM alpine:3.16
    RUN sed -i “s/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g” /etc/apk/repositories
    RUN apk update
    RUN apk add –no-cache nodejs=16.16.0-r0
    RUN apk add –no-cache npm=8.10.0-r0
    RUN npm i pm2 -g
    RUN apk add git curl
    RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    && echo “Asia/Shanghai” > /etc/timezone
    && apk del tzdata
    RUN mkdir /home/data
    WORKDIR /home/data
    USER root
    RUN git config –global http.version HTTP/1.1
    RUN git clone https://github.com/UnblockNeteaseMusic/server.git && cd /home/data/server
    RUN pm2 start /home/data/server/app.js –name=”http_endpoit” — -s -p port1:port2 -o kuwo qq migu && pm2 save #&& pm2 startup

    RUN su apk add bash

    RUN curl -O https://raw.githubusercontent.com/v2fly/alpinelinux-install-v2ray/master/install-release.sh
    RUN git init && git config –global http.sslVerify “false” &&git config –global http.version HTTP/1.1

    RUN apk update

    RUN ash install-release.sh #&& rc-update add v2ray && rc-service v2ray start
    COPY ./config.json /usr/local/etc/v2ray/

  5. 起床了吗
    Chrome 105.0.0.0
    5天前
    2022-9-23 15:43:54

    大佬,我安卓就使用V2RAYNG一个,有没有可以用在这个APP上的方法。

发送评论 编辑评论


|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇