unblock-netease-music
Advanced tools
Comparing version 1.2.7 to 1.2.9
@@ -10,2 +10,3 @@ var program = require('commander'); | ||
.option('-q, --qq', 'Find copyright music on QQ Music.') | ||
.option('-r, --rewrite-url', 'Rewrite music download url, let client download file through proxy.') | ||
.parse(process.argv); | ||
@@ -22,12 +23,15 @@ | ||
if(program.kugou){ | ||
if (program.rewriteUrl) { | ||
console.log('Rewrite music download url.'.green); | ||
} | ||
if (program.kugou) { | ||
console.log('Finding copyright music on Kugou.'.green); | ||
} | ||
if(program.dongting){ | ||
if (program.dongting) { | ||
console.log('Finding copyright music on TianTianDongTing.'.green); | ||
} | ||
if(program.qq){ | ||
if (program.qq) { | ||
console.log('Finding copyright music on QQ Music.'.green); | ||
} | ||
if(!program.kugou && !program.dongting && !program.qq){ | ||
if (!program.kugou && !program.dongting && !program.qq) { | ||
console.log('Proxy will do nothing with copyright music.'.yellow); | ||
@@ -34,0 +38,0 @@ } |
@@ -22,2 +22,10 @@ var colors = require('colors'); | ||
// 魔改 Kugou 的下载请求,应对某司防火墙 | ||
if (/^\/kugou/.test(req.url)) { | ||
req.headers['user-agent'] = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36"; | ||
req.headers['host'] = "fs.web.kugou.com"; | ||
req.url = "http://fs.web.kugou.com" + req.url.replace("/kugou", ""); | ||
yield next; | ||
} | ||
// 禁止客户端自动更新提示 | ||
@@ -33,11 +41,11 @@ if (/^\/eapi\/osx\/version/.test(req.url) || | ||
if (/^\/eapi\/v3\/song\/detail/.test(req.url) || | ||
/^\/eapi\/v3\/playlist\/detail/.test(req.url) || | ||
/^\/eapi\/v1\/album/.test(req.url) || | ||
/^\/eapi\/batch/.test(req.url) || | ||
/^\/eapi\/cloudsearch\/pc/.test(req.url) || | ||
/^\/eapi\/v1\/artist/.test(req.url) || | ||
/^\/eapi\/v1\/search\/get/.test(req.url) || | ||
/^\/eapi\/song\/enhance\/privilege/.test(req.url) || | ||
/^\/eapi\/v1\/discovery\/new\/songs/.test(req.url) || | ||
/^\/eapi\/v1\/play\/record/.test(req.url)) { | ||
/^\/eapi\/v3\/playlist\/detail/.test(req.url) || | ||
/^\/eapi\/v1\/album/.test(req.url) || | ||
/^\/eapi\/batch/.test(req.url) || | ||
/^\/eapi\/cloudsearch\/pc/.test(req.url) || | ||
/^\/eapi\/v1\/artist/.test(req.url) || | ||
/^\/eapi\/v1\/search\/get/.test(req.url) || | ||
/^\/eapi\/song\/enhance\/privilege/.test(req.url) || | ||
/^\/eapi\/v1\/discovery\/new\/songs/.test(req.url) || | ||
/^\/eapi\/v1\/play\/record/.test(req.url)) { | ||
@@ -47,4 +55,6 @@ _this.defaultBody = utils.netease.modifyDetailApi(this.defaultBody); | ||
} else if (/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { | ||
} | ||
else if (/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { | ||
try { | ||
@@ -78,4 +88,6 @@ var data = JSON.parse(_this.defaultBody); | ||
} else if (/^\/eapi\/song\/enhance\/download\/url/.test(req.url)) { | ||
} | ||
else if (/^\/eapi\/song\/enhance\/download\/url/.test(req.url)) { | ||
if (utils.netease.getDownloadReturnCode(_this.defaultBody) != 200) { | ||
@@ -95,4 +107,8 @@ var songId = utils.netease.getDownloadSongId(_this.defaultBody); | ||
} | ||
// else if (/^\/eapi\/v1\/playlist\/manipulate\/tracks/.test(req.url)) { | ||
// console.log(_this.defaultBody); | ||
// } | ||
} | ||
module.exports = modify; |
@@ -90,3 +90,3 @@ var request = require('request'); | ||
followRedirect: false, | ||
timeout: 10000 | ||
timeout: 3000 | ||
}; | ||
@@ -116,2 +116,3 @@ | ||
}); | ||
// console.log(rawBody.toString()); | ||
var result = yield post(url, req.headers, rawBody); | ||
@@ -118,0 +119,0 @@ var headers = result[0].headers; |
@@ -7,2 +7,3 @@ var colors = require('colors'); | ||
var common = require('../common'); | ||
var config = require('../../config'); | ||
@@ -30,3 +31,3 @@ var kugou = function() {}; | ||
var hash320 = data['data']['info'][0]['320hash']; | ||
var result = { | ||
result = { | ||
hash: hash320, | ||
@@ -38,3 +39,3 @@ bitrate: 320000, | ||
} else { | ||
console.error('No resource found on kugou.'.yellow) | ||
console.error('No resource found on kugou.'.yellow); | ||
return resolve(null); | ||
@@ -61,2 +62,8 @@ } | ||
var url = data['url']; | ||
// 魔改 URL 应对某司防火墙 | ||
if(config.rewriteUrl) { | ||
url = url.replace('fs.web.kugou.com', 'music.163.com/kugou'); | ||
} | ||
resolve(url); | ||
@@ -63,0 +70,0 @@ } else { |
@@ -115,6 +115,12 @@ var colors = require('colors'); | ||
return body | ||
.replace(/\"pl\":\d+/g, '"pl":320000') | ||
.replace(/\"dl\":\d+/g, '"dl":320000') | ||
.replace(/\"pl\":0/g, '"pl":320000') | ||
.replace(/\"dl\":0/g, '"dl":320000') | ||
.replace(/\"fl\":0/g, '"fl":320000') | ||
.replace(/\"st\":-?\d+/g, '"st":0') | ||
.replace(/\"subp\":\d+/g, '"subp":1'); | ||
.replace(/\"subp\":\d+/g, '"subp":1') | ||
.replace(/\"sp\":0/g, '"sp":7') | ||
.replace(/\"cp\":0/g, '"cp":1') | ||
.replace(/\"fee\":\d+/g, '"fee":0') | ||
.replace(/\"abroad\":1,/g, '') | ||
.replace(/\"paid\":false/g, '"paid":true'); | ||
}; | ||
@@ -121,0 +127,0 @@ |
@@ -30,3 +30,3 @@ var colors = require('colors'); | ||
var list = data.data.song.list[0].f.split('|'); | ||
var result = { | ||
result = { | ||
url: 'http://music.163.com/qqmusic/' + list[0] + '.mp3', | ||
@@ -33,0 +33,0 @@ bitrate: list[13], |
{ | ||
"name": "unblock-netease-music", | ||
"version": "1.2.7", | ||
"version": "1.2.9", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "start": "node ./bin/www" |
@@ -18,3 +18,3 @@ # UnblockNeteaseMusic | ||
1. `npm install unblock-netease-music -g` | ||
1. `npm install unblock-netease-music@1.2.7 -g` | ||
2. `unblockneteasemusic` | ||
@@ -43,2 +43,3 @@ | ||
-q, --qq Find copyright music on QQ Music. | ||
-r, --rewrite-url Rewrite music download url, let client download file through proxy. | ||
``` | ||
@@ -49,3 +50,3 @@ | ||
1. 向 /etc/hosts 文件中添加一行:`127.0.0.1 music.163.com` | ||
2. 使用 80 端口启动代理服务 `sudo unblockneteasemusic -p 80` | ||
2. 使用 80 端口启动代理服务 `sudo unblockneteasemusic@1.2.7 -p 80` | ||
@@ -89,51 +90,4 @@ P.S. 请务必不要更新客户端到 1.4.3 以上的版本。 [下载链接](http://s1.music.126.net/download/osx/NeteaseMusic_1.4.3_452_web.dmg) | ||
1. 安装 nginx 和 Node.js | ||
2. Nginx 配置如下 | ||
请查阅 master 分支。 | ||
``` | ||
server { | ||
listen 80; | ||
server_name music.163.com; | ||
location / { | ||
if ($http_host !~* ^(music.163.com)$){ | ||
return 500; | ||
} | ||
proxy_pass http://localhost:8123; | ||
proxy_set_header Host $host; | ||
} | ||
} | ||
``` | ||
3. 安装 sniproxy,配置如下 | ||
``` | ||
user daemon | ||
pidfile /var/run/sniproxy.pid | ||
error_log { | ||
syslog daemon | ||
priority notice | ||
} | ||
listen <YOUR_SERVER_IP>:443 { | ||
proto tls | ||
table https_hosts | ||
access_log { | ||
filename /var/log/sniproxy/https_access.log | ||
priority notice | ||
} | ||
fallback 127.0.0.1:443 | ||
} | ||
table https_hosts { | ||
music.163.com 223.252.199.7:443 | ||
} | ||
``` | ||
4. 安装本代理 `sudo npm install unblock-netease-music -g` | ||
5. 运行 `unblockneteasemusic`. | ||
6. 完成! | ||
# 预览 | ||
@@ -140,0 +94,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27737
630
102