Giter Club home page Giter Club logo

unblockneteasemusic's Introduction

logo

UnblockNeteaseMusic

解锁网易云音乐客户端变灰歌曲

特性

  • 使用 QQ / 虾米 / 百度 / 酷狗 / 酷我 / 咪咕 / JOOX 音源替换变灰歌曲链接 (默认仅启用一、五、六)
  • 为请求增加 X-Real-IP 参数解锁海外限制,支持指定网易云服务器 IP,支持设置上游 HTTP / HTTPS 代理
  • 完整的流量代理功能 (HTTP / HTTPS),可直接作为系统代理 (同时支持 PAC)

运行

使用 npx

$ npx @nondanee/unblockneteasemusic

或使用 Docker

$ docker run nondanee/unblockneteasemusic
$ docker-compose up

配置参数

$ 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

使用

警告:本项目不提供线上 demo,请不要轻易信任使用他人提供的公开代理服务,以免发生安全问题

若将服务部署到公网,强烈建议使用严格模式 (此模式下仅放行网易云音乐所属域名的请求) -s 限制代理范围 (需使用 PAC 或 hosts),或启用 Proxy Authentication -t <name>:<password> 设置代理用户名密码 (目前密码认证在 Windows 客户端设置和 macOS 系统设置都无法生效,请不要使用),以防代理被他人滥用

支持 Windows 客户端,UWP 客户端,Android 客户端,Linux 客户端 (1.2 版本以上需要自签证书 MITM,启动客户端需要增加 --ignore-certificate-errors 参数),macOS 客户端 (726 版本以上需要自签证书),iOS 客户端 (配置 https endpoint 或使用自签证书) 和网页版 (需要自签证书,需要脚本配合)

目前除 UWP 外其它客户端均优先请求 HTTPS 接口,默认配置下本代理对网易云所有 HTTPS API 连接返回空数据,促使客户端降级使用 HTTP 接口 (新版 Linux 客户端和 macOS 客户端已无法降级)

因 UWP 应用存在网络隔离,限制流量发送到本机,若使用的代理在 localhost,或修改的 hosts 指向 localhost,需为 "网易云音乐 UWP" 手动开启 loopback 才能使用,请以管理员身份执行命令

checknetisolation loopbackexempt -a -n="1F8B0F94.122165AE053F_j2p0p5q0044a6"

方法 1. 修改 hosts

向 hosts 文件添加两条规则

<Server IP> music.163.com
<Server IP> interface.music.163.com

使用此方法必须监听 80 端口 -p 80

若在本机运行程序,请指定网易云服务器 IP -f xxx.xxx.xxx.xxx (可在修改 hosts 前通过 ping music.163.com 获得) 使用代理 -u http(s)://xxx.xxx.xxx.xxx:xxx,以防请求死循环

Android 客户端下修改 hosts 无法直接使用,原因和解决方法详见云音乐安卓又搞事啦安卓免 root 绕过网易云音乐 IP 限制

方法 2. 设置代理

PAC 自动代理脚本地址 http://<Server Name:PORT>/proxy.pac

全局代理地址填写服务器地址和端口号即可

平台 基础设置
Windows 设置 > 工具 > 自定义代理 (客户端内)
UWP Windows 设置 > 网络和 Internet > 代理
Linux 系统设置 > 网络 > 网络代理
macOS 系统偏好设置 > 网络 > 高级 > 代理
Android WLAN > 修改网络 > 高级选项 > 代理
iOS 无线局域网 > HTTP 代理 > 配置代理

代理工具和方法有很多请自行探索,欢迎在 issues 讨论

✳方法 3. 调用接口

作为依赖库使用

$ npm install @nondanee/unblockneteasemusic
const match = require('@nondanee/unblockneteasemusic')

/** 
 * Set proxy or hosts if needed
 */
global.proxy = require('url').parse('http://127.0.0.1:1080')
global.hosts = {'i.y.qq.com': '59.37.96.220'}

/**
 * Find matching song from other platforms
 * @param {Number} id netease song id
 * @param {Array<String>||undefined} source support qq, xiami, baidu, kugou, kuwo, migu, joox
 * @return {Promise<Object>}
 */
match(418602084, ['qq', 'kuwo', 'migu']).then(console.log)

效果

Windows 客户端

UWP 客户端

Linux 客户端

macOS 客户端

Android 客户端

iOS 客户端

致谢

感谢大佬们为逆向 eapi 所做的努力

使用的其它平台音源 API 出自

trazyn/ieaseMusic

listen1/listen1_chrome_extension

向所有同类项目致敬

EraserKing/CloudMusicGear

EraserKing/Unblock163MusicClient

ITJesse/UnblockNeteaseMusic

bin456789/Unblock163MusicClient-Xposed

YiuChoi/Unlock163Music

yi-ji/NeteaseMusicAbroad

stomakun/NeteaseReverseLadder

fengjueming/unblock-NetEaseMusic

acgotaku/NetEaseMusicWorld

mengskysama/163-Cloud-Music-Unlock

azureplus/163-music-unlock

typcn/163music-mac-client-unlock

许可

The MIT License

unblockneteasemusic's People

Contributors

henryqw avatar kusstar avatar leomikezee avatar monkeywie avatar nondanee avatar predprey2 avatar steven7851 avatar sunzongzheng avatar u3u avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unblockneteasemusic's Issues

無法連上網易雲

windows 10, v2.5.0, host 修改, 海外, Nodejs v10.15.0
ping music.163.com後得到 103.65.41.125
用cmd執行node app.js -p 80 -f 103.65.41.125
得到Server running @ http://0.0.0.0:8080
開啟後無法登入
如果用原ip登入後再用此修改host的方式開啟就看不到歌單也沒辦法聽到任何歌
請問是此方式失效了嗎?

去除vip标签?

对于有vip标签的音乐,会导致下载结果为ncm,且无会员状态下不播放本地文件

iptables屏蔽地址如何查找?

还是倾向使用host
不然每次听歌都要挂代理有点麻烦
android端的
iptables里设置屏蔽的ip如何查找?这个应该是会变的吧 我试了下223.252.199.10不管用

紧急通告

抱歉的通知各位

QQ 音乐 vkey 策略变动

目前网上流传的提升音质方法应该都失效了,包括各种无损下载器,包括音量增强器
暂时只能回滚到 m4a 音源

虾米 API 被 punish

会修复,不过现在虾米有海外墙了

修复时间待定

变灰歌曲破解後還是播放失敗

有沒有人跟我一樣,使用音量增強器可以破解手機端变灰歌曲,但這個hosts方法破解好像只破解讓歌曲顯示不变灰而已

使用PC版本2.5.0的一些问题

我已经用hosts的方法搭建完了,打开云音乐也可以使用了。但是变灰的歌虽然没变黑,但是打开来是播放失败。并不能听.其他的歌不受影响。可以播放。我在想是不是和我ip有关。我拿的一台英国的ip搭建的。属于欧盟的范围。。还是姿势不对

显示TUNNEL的时候客户端会网络异常

我是挂载NAS的Docker,有公网IP走DDNS。如果我通过Clash走HTTP代理music.163.com和interface.music163.com。就会显示TUNNEL - music.163.com:80, 客户端显示网络异常。

如果通过Proxifier同样走HTTP代理,则是MITM > music.163.com. 能够正常工作。所以我有点懵,不知道是哪儿出了问题。麻烦指导以下。

image

「iOS/macOS」能否屏蔽欧盟 GDPR ?

启动时会针对欧盟 IP 做检测,不知能否通过伪装跳过?理论上部署服务器不在欧盟境内就能绕过这个问题,无奈我的部署环境都在欧盟。

iOS:
image

macOS:直接 301 无法登陆
image

配合 Surge 或 Clash 食用

Surge for macOS 配置

[Proxy]
UnblockNeteaseMusic = http,<Server Name>,<PORT>,,

[Rule]
PROCESS-NAME,NeteaseMusic,UnblockNeteaseMusic 
FINAL,DIRECT

Surge for iOS 配置

iOS 端限制较多, 你应该需要 "配置 https 转发",见下文

[Proxy]
UnblockNeteaseMusic = http,<Server Name>,<PORT>,,

[Rule]
USER-AGENT,NeteaseMusic*,UnblockNeteaseMusic 
FINAL,DIRECT

若需要使用 Surge 的 MITM 功能,再加上 (感谢 @wangliangliang2 提供 #314 )

[MITM]
hostname = music.163.com,*.music.163.com

Clash 配置

Clash 已于 1.1.0 版本支持了 Linux, MacOS, Windows 三端的 Process-Name 规则。
若你使用 Clash 的最新版本,可以尝试下面被注释的那一行。理论上能将网易云发出的流量全部走代理。

only test on MacOS.

Proxy:
  - name: "UnblockNeteaseMusic"
    type: http
    server: <Server-IP>
    port: <Server-Port>
Rule:
- DOMAIN-SUFFIX,163.com,UnblockNeteaseMusic
# - PROCESS-NAME, NeteaseMusic, UnblockNeteaseMusic 
- GEOIP,CN,DIRECT
- MATCH,DIRECT

Clash 安卓端配置参考 #162

✳配置 https 转发

如果日志显示有匹配结果但是 iOS 客户端仍提示无法播放

那应该是返回数据中以 http://music.163.com/package/ 开头的音源链接被客户端擅自升级到 https
因链接请求会被 unblock server 当成 HTTPS API 请求主动 block (降级策略) 而无法加载

你可能需要做以下的尝试 (选其一)

  1. 有域名和申请证书条件的话,可以配置一个额外的 https 站点转发,参考 #65
  2. 或者安装仓库内的 CA 证书或自己签发的证书并开启 https 监听,参考 #48 #65 (comment)

关于 /package 的用途和 -s endpoint 相关问题,参考 #143 (comment)

搜索被和谐的歌手时有未处理的异常

(node:4460) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'songs' of undefined
    at F:\github\UnblockNeteaseMusic\proxy.js:284:25
    at new Promise (<anonymous>)
    at bodyHook (F:\github\UnblockNeteaseMusic\proxy.js:217:9)
    at F:\github\UnblockNeteaseMusic\proxy.js:128:9
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
(node:4460) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)

食用指南

应课代表 @theandychung 的 PR #21 增加详细使用教程
若仍有部署安装上的问题请在下方评论
改进意见、bug 反馈等请新开 issue

P.S. 参与讨论并解决了疑问之后,可以点右侧 Unsubscribe 取消提醒,以防邮箱爆满
P.P.S. clone 了旧代码的同学请定期 git pull 更新, fork 了旧代码的同学请定期 New pull request 同步

在 follow 下面的步骤之前,希望你已仔细阅读过 README 中的 "使用" 部分,对配置过程也有初步了解

本篇为基础配置,所有平台通用
README 中提到对部分平台客户端有额外要求,相关教程参考其它带有紫色 "pinned" 标签的 issue

不会用,请问作者QQ多少啊

你好 作者,我看那个说明书,我 在 源文件打开CMD窗口 输入 node app.js 它说我服务运行在 http://0.0.0.0:8080 这里,我打开网易云 客户端 还是不能下载 已经下架的歌曲,我也修改了host文件

Error: ENOENT: no such file or directory, open './keys/server.key'

直接使用nohup node app.js -s -p port & 命令后台运行时。出现了报错,报错信息提示Error: ENOENT: no such file or directory, open './keys/server.key'。检查了的server.js路径下的代码。发现server.key与server.crt是直接使用"./"方式进行引用的。应该使用pwd等参数改成绝对路径引用。

运行一段时间后会 crash

OS: macOS Mojave
node: 10.9.0
一般用 screen 挂着当后台程序,改 hosts 的模式。
log


Server running @ http://0.0.0.0:80
...
HTTP > http://music.163.com
HTTP > http://music.163.com
HTTP > http://music.163.com
HTTPS > https://alogs.umeng.com:443
HTTP > http://www.localnetwork.uop
events.js:167
      throw er; // Unhandled 'error' event
      ^
Error: read ECONNRESET
    at TCP.onread (net.js:660:25)
Emitted 'error' event at:
    at Socket.onerror (_stream_readable.js:690:12)
    at Socket.emit (events.js:182:13)
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

虾米异常

search api 回应 {"rgv587_flag":"sm","url":"https://www.taobao.com/markets/bx/deny_h5"}

海外 vps 如何配合 nginx 使用

现状

服务端

我在我 美国西部 的 VPS 上搭建服务

我现在用 docker 启动一个实例监听 8653 端口

启动命令:

docker run -dt --name unblockneteasemusic --restart=always -p 8653:8080 nondanee/unblockneteasemusic -s -f 59.111.181.61

效果如下:

CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                                            NAMES
74376c5eb6f4        nondanee/unblockneteasemusic   "node app.js -s"         11 hours ago        Up 11 hours         0.0.0.0:8653->8080/tcp                           unblockneteasemusic

然后我用 nginx 监听 80 端口,并且添加配置文件

server {
    listen 80;
    server_name music.163.com interface.music.163.com;

    access_log  /var/log/nginx/163.log  main;

    location / {
        proxy_pass http://127.0.0.1:8653;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Accept-Encoding "";
    }
}

客户端

然后我在 mac 机器上添加 HOST 记录

# 1.2.3.4 代表 美西服务器 的 IPV4
1.2.3.4 music.163.com
1.2.3.4 interface.music.163.com

然后发现,听不了歌曲

image

可以看到底部的时间显示一直都是 00:00:00

客户端版本 2.0.0 (700)

image

另外发现

在这种模式下,我尝试请求 http://music.163.com/ ,尝试抓包发现我的 美西服务器 返回了 302 到 https

image

这个有没有办法弄一下
就是我 http 请求 UnblockNeteaseMusicUnblockNeteaseMusic 以 https 请求网易云服务器,然后返回页面 html

问题

因为我 VPS 上 80 端口还要做其他事情,所以必须需要有一个 nginx,这种情况下,该如何食用?

关于单应用代理

有没有可能通过代理服务器ssr流量从而实现安卓端的单应用代理,这样能节省很多资源

酷我的接口已经改了~

你原本的接口搜不到好多歌~

然后稍微改了下,现在已经好了。。

const request = require('../request.js')

function search(songInfo){
	var url =
		'http://search.kuwo.cn/r.s?SONGNAME=' + encodeURIComponent(songInfo.name) + '&ARTIST='+encodeURIComponent(songInfo.artists[0].name)+'&ft=music&rformat=json&encoding=utf8&rn=8&callback=song&vipver=MUSIC_8.0.3.1'
	return request('GET', url)
	.then(function(response){
		var jsonBody = JSON.parse(response.body.replace(/(\')/g, '"').replace("try {var jsondata =", '').replace(";song(jsondata);}catch(e){jsonError(e)}",""))

		var chief = jsonBody['abslist'][0]
		if(chief)
			return chief.MUSICRID.split('_').pop()
		else
			return Promise.reject()
	})
}

function track(id){
	var url =
		'http://antiserver.kuwo.cn/anti.s?' +
		'type=convert_url&format=aac|mp3|wma&response=url&rid=MUSIC_' + id

	return request('GET', url)
	.then(function(response){
		if (response.body)
			return response.body
		else
			return Promise.reject()
	})
}

function check(songInfo){
	return search(songInfo)
	.then(function(songId){
		return track(songId)
	})
	.catch(function(e){
		return
	})
}

module.exports = {check}

歌曲无法播放

(node:24237) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): SyntaxError: Unexpected token u in JSON at position 0
使用代理器

crypto.js 报错了

是否解密问题了

node app.js -p 1630

Server running @ http://0.0.0.0:1630
Proxy HTTP request for: http://music.163.com
crypto.js:170
  var ret = this._handle.update(data, inputEncoding);
                         ^

TypeError: Bad input string
    at Decipheriv.update (crypto.js:170:26)
    at decrypt (/www/wwwroot/qt/UnblockNeteaseMusic/crypto.js:9:22)
    at decryptEapi (/www/wwwroot/qt/UnblockNeteaseMusic/crypto.js:22:9)
    at IncomingMessage.<anonymous> (/www/wwwroot/qt/UnblockNeteaseMusic/proxy.js:86:14)
    at emitNone (events.js:106:13)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

$ node app.js 是在本地部署运行吗?

小白一枚 之前没接触过node.js 刚安装node.js的软件,下一步该怎么操作,能否提供node.js的入门资料或者这个项目使用详细教程?感谢!

我的电台bug

bug列表写我的电台不能用
但是我这边很正常...
image

android端的指定代理问题

在termux上安装了项目并且测试在wifi下可以正常解锁。
但是在移动网络下无效,想法是尝试用代理软件指定网易云,但是试了好几个软件都无效不知道为什么。
adguard里自带的代理,127.0.0.1:8080下指定网易云后代理提示正常,网易云无效。
drony里设置127.0.0.1:8080后termux里全局都有流量在跑,但是唯独网易云提示网络异常。
ss里设置127.0.0.1后网易云网络异常
不知 @nondanee 有没有android端可以用的指定应用走http代理的app。我找了好多发现都无法使用。要么网易云不生效,要么就是网易云提示网络异常。

已知 BUG

在这里公示目前无法处理的 BUG

一个导致不能下载并且血崩的错误

作者大大,今天在下载歌曲的时候弹出了一个错误,在某些特定歌曲必定会出现,出现问题后后面所有的歌曲都会因为网络错误无法下载。
请问这个有办法解决吗?
snipaste_2018-09-15_15-40-33
snipaste_2018-09-15_15-40-51

无法稳定运行

macOS 10.4.4
UnblockNeteaseMusic b0b1afc(但在这个 commit 之前也会出现)
NeteaseMusic 2.0.0(730)

hosts 模式,在一段时间的运行后会无法播放音乐(表现为歌单里的会不断跳过),log 里也只有一行MITM > music.163.com 且难以稳定复现...但差不多每天都会出现一次。重开网易云可以解决。

不知道有没有什么好的测试办法,比如运行的时候 verbose?但 -v 被输出版本占用了

关于使用

因为对node端口类不是很懂。
请问作为windows用户的话,怎么使用呢?

进阶配置

除了基本的命令行参数,在源码中还预留了一些可配置位置
如果有能力,可以了解一下这个部分

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.