├── .dockerignore
├── .github
└── workflows
│ └── publish.yml
├── .gitignore
├── .npmignore
├── Dockerfile
├── LICENSE
├── README.md
├── app.js
├── bridge.js
├── ca.crt
├── docker-compose.yml
├── endpoint.worker.js
├── package.json
├── server.crt
├── server.key
└── src
├── app.js
├── bridge.js
├── browser
├── README.md
├── background.html
├── background.js
├── convert.js
├── crypto.js
├── inject.js
├── manifest.json
├── request.js
└── script.js
├── cache.js
├── cli.js
├── crypto.js
├── hook.js
├── kwDES.js
├── provider
├── baidu.js
├── find.js
├── insure.js
├── joox.js
├── kugou.js
├── kuwo.js
├── match.js
├── migu.js
├── netease.js
├── qq.js
├── select.js
├── xiami.js
└── youtube.js
├── request.js
├── server.js
└── sni.js
/.dockerignore:
--------------------------------------------------------------------------------
1 | .git
2 | .npmignore
3 | .gitignore
4 | .dockerignore
5 |
6 | LICENSE
7 | *.md
8 |
9 | node_modules
10 | npm-debug.log
11 |
12 | Dockerfile*
13 | *.yml
14 |
15 | src/browser/
16 | ca.*
17 | *.worker.js
--------------------------------------------------------------------------------
/.github/workflows/publish.yml:
--------------------------------------------------------------------------------
1 | name: publish
2 |
3 | on:
4 | push:
5 | tags:
6 | - '*'
7 |
8 | jobs:
9 | docker:
10 | runs-on: ubuntu-latest
11 | env:
12 | REPOSITORY: unblockneteasemusic
13 | DOCKER_USERNAME: nondanee
14 | DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
15 | steps:
16 | -
17 | name: Prepare
18 | id: prepare
19 | run: |
20 | ARCH=(amd64 arm/v6 arm/v7 arm64 386 ppc64le s390x)
21 | PLATFORM=$(printf ",linux/%s" "${ARCH[@]}")
22 | echo ::set-output name=build_platform::${PLATFORM:1}
23 | echo ::set-output name=image_name::${DOCKER_USERNAME}/${REPOSITORY}
24 | -
25 | name: Checkout
26 | uses: actions/checkout@v2
27 | -
28 | name: Setup Buildx
29 | uses: crazy-max/ghaction-docker-buildx@v1
30 | -
31 | name: Login
32 | run: |
33 | echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
34 | -
35 | name: Build
36 | run: |
37 | docker buildx build \
38 | --tag ${{ steps.prepare.outputs.image_name }} \
39 | --platform ${{ steps.prepare.outputs.build_platform }} \
40 | --output "type=image,push=true" \
41 | --file Dockerfile .
42 | -
43 | name: Check Manifest
44 | run: |
45 | docker buildx imagetools inspect ${{ steps.prepare.outputs.image_name }}
46 |
47 | npm:
48 | runs-on: ubuntu-latest
49 | steps:
50 | -
51 | name: Checkout
52 | uses: actions/checkout@v2
53 | -
54 | name: Setup Node.js
55 | uses: actions/setup-node@v1
56 | with:
57 | registry-url: https://registry.npmjs.org/
58 | -
59 | name: Publish
60 | run: npm publish
61 | env:
62 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # IDE
2 | .vscode
3 | .idea
4 |
5 | # Logs
6 | logs
7 | *.log
8 | npm-debug.log*
9 | yarn-debug.log*
10 | yarn-error.log*
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 |
24 | # nyc test coverage
25 | .nyc_output
26 |
27 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
28 | .grunt
29 |
30 | # Bower dependency directory (https://bower.io/)
31 | bower_components
32 |
33 | # node-waf configuration
34 | .lock-wscript
35 |
36 | # Compiled binary addons (https://nodejs.org/api/addons.html)
37 | build/Release
38 |
39 | # Dependency directories
40 | node_modules/
41 | jspm_packages/
42 |
43 | # TypeScript v1 declaration files
44 | typings/
45 |
46 | # Optional npm cache directory
47 | .npm
48 |
49 | # Optional eslint cache
50 | .eslintcache
51 |
52 | # Optional REPL history
53 | .node_repl_history
54 |
55 | # Output of 'npm pack'
56 | *.tgz
57 |
58 | # Yarn Integrity file
59 | .yarn-integrity
60 |
61 | # dotenv environment variables file
62 | .env
63 |
64 | # next.js build output
65 | .next
66 |
67 | # pkg dist directory
68 | dist/
69 |
70 | # es6 transformation
71 | src/browser/provider
72 | src/browser/cache.js
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | .npmignore
2 | .gitignore
3 | .dockerignore
4 |
5 | Dockerfile*
6 | *.yml
7 |
8 | src/browser/
9 | ca.*
10 | *.worker.js
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM alpine
2 | RUN apk add --update nodejs npm --repository=http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/
3 |
4 | ENV NODE_ENV production
5 |
6 | WORKDIR /usr/src/app
7 | COPY package*.json ./
8 | RUN npm install --production
9 | COPY . .
10 |
11 | EXPOSE 8080 8081
12 |
13 | ENTRYPOINT ["node", "app.js"]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Nzix
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # UnblockNeteaseMusic
4 |
5 | 解锁网易云音乐客户端变灰歌曲
6 |
7 | ## 特性
8 |
9 | - 使用 QQ / 虾米 / 百度 / 酷狗 / 酷我 / 咪咕 / JOOX 音源替换变灰歌曲链接 (默认仅启用一、五、六)
10 | - 为请求增加 `X-Real-IP` 参数解锁海外限制,支持指定网易云服务器 IP,支持设置上游 HTTP / HTTPS 代理
11 | - 完整的流量代理功能 (HTTP / HTTPS),可直接作为系统代理 (同时支持 PAC)
12 |
13 | ## 运行
14 |
15 | 使用 npx
16 |
17 | ```
18 | $ npx @nondanee/unblockneteasemusic
19 | ```
20 |
21 | 或使用 Docker
22 |
23 | ```
24 | $ docker run nondanee/unblockneteasemusic
25 | ```
26 |
27 | ```
28 | $ docker-compose up
29 | ```
30 |
31 | ### 配置参数
32 |
33 | ```
34 | $ unblockneteasemusic -h
35 | usage: unblockneteasemusic [-v] [-p port] [-a address] [-u url] [-f host]
36 | [-o source [source ...]] [-t token] [-e url] [-s]
37 | [-h]
38 |
39 | optional arguments:
40 | -v, --version output the version number
41 | -p port, --port port specify server port
42 | -a address, --address address specify server host
43 | -u url, --proxy-url url request through upstream proxy
44 | -f host, --force-host host force the netease server ip
45 | -o source [source ...], --match-order source [source ...]
46 | set priority of sources
47 | -t token, --token token set up proxy authentication
48 | -e url, --endpoint url replace virtual endpoint with public host
49 | -s, --strict enable proxy limitation
50 | -h, --help output usage information
51 | ```
52 |
53 | ## 使用
54 |
55 | **警告:本项目不提供线上 demo,请不要轻易信任使用他人提供的公开代理服务,以免发生安全问题**
56 |
57 | **若将服务部署到公网,强烈建议使用严格模式 (此模式下仅放行网易云音乐所属域名的请求) `-s` 限制代理范围 (需使用 PAC 或 hosts),~~或启用 Proxy Authentication `-t :` 设置代理用户名密码~~ (目前密码认证在 Windows 客户端设置和 macOS 系统设置都无法生效,请不要使用),以防代理被他人滥用**
58 |
59 | 支持 Windows 客户端,UWP 客户端,Android 客户端,Linux 客户端 (1.2 版本以上需要自签证书 MITM,启动客户端需要增加 `--ignore-certificate-errors` 参数),macOS 客户端 (726 版本以上需要自签证书),iOS 客户端 (配置 https endpoint 或使用自签证书) 和网页版 (需要自签证书,需要脚本配合)
60 |
61 | 目前除 UWP 外其它客户端均优先请求 HTTPS 接口,默认配置下本代理对网易云所有 HTTPS API 连接返回空数据,促使客户端降级使用 HTTP 接口 (新版 Linux 客户端和 macOS 客户端已无法降级)
62 |
63 | 因 UWP 应用存在网络隔离,限制流量发送到本机,若使用的代理在 localhost,或修改的 hosts 指向 localhost,需为 "网易云音乐 UWP" 手动开启 loopback 才能使用,请以**管理员身份**执行命令
64 |
65 | ```powershell
66 | checknetisolation loopbackexempt -a -n="1F8B0F94.122165AE053F_j2p0p5q0044a6"
67 | ```
68 |
69 | ### 方法 1. 修改 hosts
70 |
71 | 向 hosts 文件添加两条规则
72 |
73 | ```
74 | music.163.com
75 | interface.music.163.com
76 | ```
77 |
78 | > 使用此方法必须监听 80 端口 `-p 80`
79 | >
80 | > **若在本机运行程序**,请指定网易云服务器 IP `-f xxx.xxx.xxx.xxx` (可在修改 hosts 前通过 `ping music.163.com` 获得) **或** 使用代理 `-u http(s)://xxx.xxx.xxx.xxx:xxx`,以防请求死循环
81 | >
82 | > **Android 客户端下修改 hosts 无法直接使用**,原因和解决方法详见[云音乐安卓又搞事啦](https://jixun.moe/post/netease-android-hosts-bypass/),[安卓免 root 绕过网易云音乐 IP 限制](https://jixun.moe/post/android-block-netease-without-root/)
83 |
84 | ### 方法 2. 设置代理
85 |
86 | PAC 自动代理脚本地址 `http:///proxy.pac`
87 |
88 | 全局代理地址填写服务器地址和端口号即可
89 |
90 | | 平台 | 基础设置 |
91 | | :------ | :------------------------------- |
92 | | Windows | 设置 > 工具 > 自定义代理 (客户端内) |
93 | | UWP | Windows 设置 > 网络和 Internet > 代理 |
94 | | Linux | 系统设置 > 网络 > 网络代理 |
95 | | macOS | 系统偏好设置 > 网络 > 高级 > 代理 |
96 | | Android | WLAN > 修改网络 > 高级选项 > 代理 |
97 | | iOS | 无线局域网 > HTTP 代理 > 配置代理 |
98 |
99 | > 代理工具和方法有很多请自行探索,欢迎在 issues 讨论
100 |
101 | ### ✳方法 3. 调用接口
102 |
103 | 作为依赖库使用
104 |
105 | ```
106 | $ npm install @nondanee/unblockneteasemusic
107 | ```
108 |
109 | ```javascript
110 | const match = require('@nondanee/unblockneteasemusic')
111 |
112 | /**
113 | * Set proxy or hosts if needed
114 | */
115 | global.proxy = require('url').parse('http://127.0.0.1:1080')
116 | global.hosts = {'i.y.qq.com': '59.37.96.220'}
117 |
118 | /**
119 | * Find matching song from other platforms
120 | * @param {Number} id netease song id
121 | * @param {Array||undefined} source support qq, xiami, baidu, kugou, kuwo, migu, joox
122 | * @return {Promise