diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..53b202c --- /dev/null +++ b/.jshintrc @@ -0,0 +1,3 @@ +{ + "esversion": 6 +} \ No newline at end of file diff --git a/README.md b/README.md index cc6fb5b..97b1519 100644 --- a/README.md +++ b/README.md @@ -7,22 +7,26 @@ [![NPM](https://nodei.co/npm/unblock-netease-music.png?downloads=true&downloadRank=true)](https://nodei.co/npm/unblock-netease-music/) -English version [here](https://github.com/ITJesse/UnblockNeteaseMusic/blob/master/README_en.md). - # 依赖 1. Node.js 4.x+ +2. Nginx with subs-filter module configured. -# 使用方法 +# 注意 -1. `npm install unblock-netease-music -g` -2. `unblockneteasemusic` +从 2.0 版本开始,本代理仅支持服务端部署。本地使用请查阅 standalone 分支,或使用 1.x 版本。 -## 测试服务 +# 使用方法 +1. 安装 Nginx 和 Node.js +2. Nginx 配置参考 `/server_config/nginx.conf.sample` +3. 安装 sniproxy,配置参考 `/server_config/sniproxy.conf.sample` +4. 安装本代理 `sudo npm install unblock-netease-music -g` +5. 后台运行 `nohup unblockneteasemusic &`. +6. 完成! -~~向 /etc/hosts 文件中添加一行:`119.29.65.105 music.163.com`~~ -本人实在是没有精力维护了,故关闭了测试服务。 +1. `npm install unblock-netease-music -g` +2. `unblockneteasemusic` ## 配置参数 @@ -37,101 +41,21 @@ unblockneteasemusic -h -p, --port Specific server port. -f, --force-ip Force the netease server ip. -k, --kugou Find copyright music on Kugou. - -d, --dongting Find copyright music on TianTianDongTing. -q, --qq Find copyright music on QQ Music. + -r, --rewrite-url Rewrite music download url, let client download file through proxy. ``` -## OSX 用户 - -1. 向 /etc/hosts 文件中添加一行:`127.0.0.1 music.163.com` -2. 使用 80 端口启动代理服务 `sudo unblockneteasemusic -p 80` +## OSX 与 Windows 用户 -P.S. 请务必不要更新客户端到 1.4.3 以上的版本。 [下载链接](http://s1.music.126.net/download/osx/NeteaseMusic_1.4.3_452_web.dmg) +向 hosts 文件中添加一行:` music.163.com` -## Windows 用户 - -1. 使用任意端口启动代理服务 `unblockneteasemusic` -3. 在客户端内配置代理服务器为 `127.0.0.1:8123` - -P.S. 请务必不要更新客户端到 2.0.2 以上的版本。 -[下载链接](http://s1.music.126.net/download/pc/cloudmusicsetup_2_0_2[128316].exe) +> OSX 用户请务必不要更新客户端到 1.4.3 以上的版本。 [下载链接](http://s1.music.126.net/download/osx/NeteaseMusic_1.4.3_452_web.dmg) +> Windows 用户请务必不要更新客户端到 2.0.2 以上的版本。 [下载链接](http://s1.music.126.net/download/pc/cloudmusicsetup_2_0_2[128316].exe) ## 其他用户 新客户端 API 有改动,已经用不了了 -## 使用 nginx 反代 - -1. 安装 nginx -2. 使用下面的配置新建一个 vhost -3. 启动 nginx. -4. 向 /etc/hosts 文件中添加一行:`127.0.0.1 music.163.com` - -# Nginx 配置 - -``` -server { - listen 80; - server_name music.163.com; - - location / { - proxy_pass http://127.0.0.1:8123; - proxy_set_header Host $host; - } -} - ``` - -# 搭建自己的代理服务器 - -1. 安装 nginx 和 Node.js -2. Nginx 配置如下 - - ``` - 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 :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. 完成! - # 预览 ![](https://dn-itjesse.qbox.me/github%2Fphoto_2016-03-31_01-11-14.jpg) diff --git a/README_en.md b/README_en.md deleted file mode 100644 index e3f5bb1..0000000 --- a/README_en.md +++ /dev/null @@ -1,125 +0,0 @@ -# UnblockNeteaseMusic - -A proxy server for Netease Music based on koa.... - -[中文版](https://github.com/ITJesse/UnblockNeteaseMusic/blob/master/README.md) - -# Dependencies - -1. Node.js 4.x+ - -# How to use - -1. `npm install unblock-netease-music -g` -2. `unblockneteasemusic` - -## Configuration - -``` -unblockneteasemusic -h - - Usage: unblockneteasemusic [options] - - Options: - - -h, --help output usage information - -p, --port Specific server port. - -f, --force-ip Force the netease server ip. - -k, --kugou Find copyright music on Kugou. - -d, --dongting Find copyright music on TianTianDongTing. - -q, --qq Find copyright music on QQ Music. -``` - -## Windows users (fixed) - -Just simply change your proxy to `127.0.0.1:8123` and restart client. - -## Others (reverse proxy by nginx) - -1. Install nginx. -2. Create a new vhost with the conf file below. -3. Start nginx. -4. Add a line into /etc/hosts `127.0.0.1 music.163.com` - -# Nginx conf file - -``` -server { - listen 80; - server_name music.163.com; - - location / { - proxy_pass http://127.0.0.1:8123; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Accept-Encoding ""; - } -} - ``` - -# Build your own proxy server - -1. Install nginx and Node.js -2. Nginx conf file - - ``` - 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; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header Accept-Encoding ""; - } - } - ``` - -3. Setup sniproxy - - ``` - user daemon - pidfile /var/run/sniproxy.pid - - error_log { - syslog daemon - priority notice - } - - listen :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. Install proxy server with command `sudo npm install unblock-netease-music -g` -5. Run proxy server `unblockneteasemusic`. -6. Done! - -# Preview - -![](https://dn-itjesse.qbox.me/github%2Fphoto_2016-03-31_01-11-14.jpg) - -# Thanks - -1. This project is based on EraserKing's [CloudMusicGear](https://github.com/EraserKing/CloudMusicGear). -2. Thanks for yanunon's [API documents](https://github.com/yanunon/NeteaseCloudMusic/wiki/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90API%E5%88%86%E6%9E%90). -3. Thanks for Chion82's conf files. - -# License - -GPLv3 diff --git a/modules/config/index.js b/modules/config/index.js index 1cdd2ff..7ad6e4d 100644 --- a/modules/config/index.js +++ b/modules/config/index.js @@ -5,7 +5,6 @@ program .option('-p, --port ', 'Specific server port.') .option('-f, --force-ip ', 'Force the netease server ip.') .option('-k, --kugou', 'Find copyright music on Kugou.') - .option('-d, --dongting', 'Find copyright music on TianTianDongTing.') .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); @@ -25,13 +24,10 @@ if (program.rewriteUrl) { if (program.kugou) { console.log('Finding copyright music on Kugou.'.green); } -if (program.dongting) { - console.log('Finding copyright music on TianTianDongTing.'.green); -} if (program.qq) { console.log('Finding copyright music on QQ Music.'.green); } -if (!program.kugou && !program.dongting && !program.qq) { +if (!program.kugou && !program.qq) { console.log('Proxy will do nothing with copyright music.'.yellow); } diff --git a/modules/modify/index.js b/modules/modify/index.js index 1ae5759..a9db1d7 100644 --- a/modules/modify/index.js +++ b/modules/modify/index.js @@ -9,53 +9,14 @@ var modify = function*(next) { var req = _this.request; var res = _this.response; - req.url = req.url.replace(/^http:\/\/music.163.com/, ''); + var songId, + urlInfo; - // 魔改 QQ Music 的下载请求,避免被 ban - if (/^\/qqmusic/.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'] = "tsmusic24.tc.qq.com"; - req.url = "http://tsmusic24.tc.qq.com" + req.url.replace("/qqmusic", ""); - yield next; - } - - // 魔改 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; - } - - // 禁止客户端自动更新提示 - if (/^\/eapi\/osx\/version/.test(req.url) || - /^\/eapi\/pc\/version/.test(req.url)) { - var v = JSON.parse(_this.defaultBody); - v.updateFiles = []; - _this.defaultBody = JSON.stringify(v); - yield next; - } - - 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)) { - - _this.defaultBody = utils.netease.modifyDetailApi(this.defaultBody); - yield next; - - } - - else if (/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { + if (/^\/eapi\/song\/enhance\/player\/url/.test(req.url)) { + var data = ''; try { - var data = JSON.parse(_this.defaultBody); + data = JSON.parse(_this.defaultBody); } catch (err) { console.error(err); return next; @@ -63,11 +24,10 @@ var modify = function*(next) { var newData = []; for (var row of data["data"]) { var playbackReturnCode = row.code; - var songId = row.id; + songId = row.id; if (playbackReturnCode != 200) { - var songId = row.id; - var urlInfo = yield utils.getUrlInfo(songId); + urlInfo = yield utils.getUrlInfo(songId); if (urlInfo) { row = utils.netease.modifyPlayerApiCustom(urlInfo, row); } else { @@ -80,30 +40,31 @@ var modify = function*(next) { } data["data"] = newData; _this.defaultBody = JSON.stringify(data); - yield next; + return next; } else if (/^\/eapi\/song\/enhance\/download\/url/.test(req.url)) { if (utils.netease.getDownloadReturnCode(_this.defaultBody) != 200) { - var songId = utils.netease.getDownloadSongId(_this.defaultBody); - var urlInfo = yield utils.getUrlInfo(songId); + songId = utils.netease.getDownloadSongId(_this.defaultBody); + urlInfo = yield utils.getUrlInfo(songId); if (urlInfo) { _this.defaultBody = utils.netease.modifyDownloadApiCustom(urlInfo, _this.defaultBody); } else { console.log('No resource.'.red); } - yield next; + return next; } else { console.log('Download bitrate is not changed. The song URL is '.green + utils.netease.getDownloadUrl(_this.defaultBody).green); - yield next; + return next; } } - // else if (/^\/eapi\/v1\/playlist\/manipulate\/tracks/.test(req.url)) { - // console.log(_this.defaultBody); - // } -} + else { + return next; + } + +}; module.exports = modify; diff --git a/modules/proxy/index.js b/modules/proxy/index.js index e7dd75d..6788ce6 100644 --- a/modules/proxy/index.js +++ b/modules/proxy/index.js @@ -1,13 +1,9 @@ var request = require('request'); var getRawBody = require('raw-body'); var extend = require('extend'); -var zlib = require('zlib'); -var Readable = require('stream').Readable; -var PassThrough = require('stream').PassThrough; var config = require('../config'); -var ip = config.forceIp ? config.forceIp : '223.252.199.7'; var sendRequest = function(options) { var defaults = { @@ -27,21 +23,6 @@ var sendRequest = function(options) { }); }; -// 封装 request get -var get = function(url, headers) { - var options = { - url: url, - headers: headers, - encoding: null // 不解析 get 请求,直接返回 Buffer - }; - - return new Promise((resolve, reject) => { - sendRequest(options) - .then((res) => resolve(res)) - .catch((err) => reject(err)); - }); -}; - // 封装 request post var post = function(url, headers, body) { var options = { @@ -66,48 +47,11 @@ var middleware = function*(next) { var req = _this.request; var res = _this.reponse; - // console.log(url); - // console.log(req.headers); - - if (req.method == 'GET') { - yield next; - - if (!/^http/.test(req.url)) { - req.url = 'http://' + ip + req.url; - } else { - req.url = req.url.replace('music.163.com', ip); - } - - _this.body = PassThrough(); - - // console.log(req.headers); - - var options = { - url: req.url, - headers: req.headers, - method: "get", - followRedirect: false, - timeout: 3000 - }; - - request(options) - .on('error', (err) => { - return console.log(err); - }) - .on('response', (response) => { - _this.status = response.statusCode; - _this.set(response.headers); - }) - .pipe(_this.body); - } - if (req.method == 'POST') { - var url = ''; - if (!/^http/.test(req.url)) { - url = 'http://' + ip + req.url; - } else { - url = req.url.replace('music.163.com', ip); - } + var ip = config.forceIp ? config.forceIp : '223.252.199.7'; + var url = 'http://' + ip + req.url; + req.headers['host'] = 'music.163.com'; + var rawBody = yield getRawBody(_this.req, { length: _this.length, encoding: _this.charset @@ -125,15 +69,6 @@ var middleware = function*(next) { yield next; // console.log("after: " + _this.defaultBody); - // var stream = new Readable; - // stream.push(_this.defaultBody); - // stream.push(null); - - // var gzip = zlib.createGzip(); - // _this.set('Content-Encoding', 'gzip'); - // _this.body = gzip; - // stream.pipe(gzip); - _this.body = _this.defaultBody; } }; diff --git a/modules/utils/common/index.js b/modules/utils/common/index.js index f3b6ae5..973fec2 100644 --- a/modules/utils/common/index.js +++ b/modules/utils/common/index.js @@ -8,7 +8,7 @@ common.sendRequest = function(options) { method: 'get', followRedirect: true, timeout: 5000 - } + }; options = extend(false, defaults, options); return new Promise((resolve, reject) => { request(options, function(err, res, body) { diff --git a/modules/utils/dongting/index.js b/modules/utils/dongting/index.js deleted file mode 100644 index 8e71069..0000000 --- a/modules/utils/dongting/index.js +++ /dev/null @@ -1,63 +0,0 @@ -var colors = require('colors'); -var md5 = require('md5'); -var request = require('request'); -var co = require('co'); - -var common = require('../common'); - -var dongting = function() {}; - -dongting.prototype.qualityFallback = function(data) { - var result = {}; - if (!!data.ll_list && data.ll_list.length > 0) { - result = { - url: data.ll_list[0].url, - bitrate: data.ll_list[0].bitRate * 1000, - filesize: parseFloat(data.ll_list[0].size) * 1024, - hash: null - } - } else { - var index = data.audition_list.length - 1; - result = { - url: data.audition_list[index].url, - bitrate: data.audition_list[index].bitRate * 1000, - filesize: Math.ceil(parseFloat(data.audition_list[index].size) * 1024 * 1024), - hash: null - } - } - return result; -}; - -dongting.prototype.search = function(name, artist) { - var _this = this; - - console.log("Search from TianTianDongTing.".green); - console.log("Song name: ".green + name); - console.log("Artist: ".green + artist); - var songName = encodeURIComponent(artist + " " + name); - var options = { - url: "http://search.dongting.com/song/search/old?page=1&size=1&q=" + songName - }; - - return new Promise((resolve, reject) => { - co(function*() { - var result = yield common.sendRequest(options); - var data = JSON.parse(result[1]); - if (data.code == 1 && - data.data.length > 0 && - data.data[0].song_name.indexOf(name) != -1) { - - var result = _this.qualityFallback(data.data[0]); - return resolve(result); - } else { - console.log("No resource found from dongting".yellow); - return resolve(null); - } - }).catch((err) => { - console.log(err); - reject(err); - }); - }); -}; - -module.exports = dongting; diff --git a/modules/utils/index.js b/modules/utils/index.js index b5d1bfb..107ebd7 100644 --- a/modules/utils/index.js +++ b/modules/utils/index.js @@ -4,7 +4,6 @@ var co = require('co'); var config = require('../config'); var netease = require('./netease'); var kugou = require('./kugou'); -var dongting = require('./dongting'); var qq = require('./qq'); var utils = function(ip) { @@ -23,11 +22,10 @@ var utils = function(ip) { if (config.qq) { this.qq = new qq(); } -} +}; /* - Get song url from kugou. - If failed, fallback to netease low-res api. + Get song url. */ utils.prototype.getUrlInfo = function(songId) { @@ -53,10 +51,6 @@ utils.prototype.getUrlInfo = function(songId) { } } - if (!songInfo && _this.dongting) { - songInfo = yield _this.dongting.search(songName, artist); - } - if (songInfo) { resolve(songInfo); } else { @@ -66,7 +60,7 @@ utils.prototype.getUrlInfo = function(songId) { console.log(err); reject(err); }); - }) -} + }); +}; module.exports = utils; diff --git a/modules/utils/netease/index.js b/modules/utils/netease/index.js index 70fadca..90616f0 100644 --- a/modules/utils/netease/index.js +++ b/modules/utils/netease/index.js @@ -7,27 +7,27 @@ var netease = function(ip) { }; netease.prototype.getDownloadReturnCode = function(body) { - var body = JSON.parse(body); + body = JSON.parse(body); return body["data"]["code"]; }; netease.prototype.getDownloadUrl = function(body) { - var body = JSON.parse(body); + body = JSON.parse(body); return body["data"]["url"]; }; netease.prototype.getSongName = function(body) { - var body = JSON.parse(body); + body = JSON.parse(body); return body["songs"][0]['name']; }; netease.prototype.getArtistName = function(body) { - var body = JSON.parse(body); + body = JSON.parse(body); return body["songs"][0]['artists'][0]['name']; }; netease.prototype.getDownloadSongId = function(body) { - var body = JSON.parse(body); + body = JSON.parse(body); return body["data"]["id"]; }; @@ -62,68 +62,6 @@ netease.prototype.getSongDetail = function(songId) { }); }; -netease.prototype.getEncId = function(dfsId) { - var byte1 = new Buffer('3go8&$8*3*3h0k(2)2'); - var byte2 = new Buffer(dfsId); - var byte1_len = byte1.length; - for (var i = 0; i < byte2.length; i++) { - byte2[i] = byte2[i] ^ byte1[i % byte1_len]; - } - var md5 = crypto.createHash('md5').update(byte2).digest('base64'); - var result = md5.replace(/\//g, '_').replace(/\+/g, '-'); - return result; -}; - -netease.prototype.getFallbackQuality = function(body) { - var body = JSON.parse(body); - - // Downgrade if we don't have higher quality... - var nQuality = 'hMusic'; - if (nQuality == "hMusic" && !!!body["songs"][0]["hMusic"]) { - nQuality = "mMusic"; - } - if (nQuality == "mMusic" && !!!body["songs"][0]["mMusic"]) { - nQuality = "lMusic"; - } - if (nQuality == "lMusic" && !!!body["songs"][0]["lMusic"]) { - nQuality = "bMusic"; - } - if (nQuality == "bMusic" && !!!body["songs"][0]["bMusic"]) { - nQuality = "audition"; - } - - if (nQuality == "audition" && !!!body["songs"][0]["audition"]) { - console.log('No resource found on netease.'.yellow); - return null; - } - - return body["songs"][0][nQuality]; -}; - -netease.prototype.generateFallbackUrl = function(dfsId) { - console.log('Fallback to netease low quality.'.yellow); - var s = (new Date()).getSeconds() % 2 + 1; - var encId = this.getEncId(dfsId); - var url = "http://m" + s + ".music.126.net/" + encId + "/" + dfsId + ".mp3"; - return url; -}; - -netease.prototype.modifyDetailApi = function(body) { - console.log("Song Detail API Injected".green); - - return body - .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(/\"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'); -}; - netease.prototype.modifyPlayerApiCustom = function(urlInfo, body) { console.log("Player API Injected".green); @@ -145,7 +83,7 @@ netease.prototype.modifyDownloadApiCustom = function(urlInfo, body) { var _this = this; - var body = JSON.parse(body); + body = JSON.parse(body); console.log("New URL is ".green + urlInfo.url); body["data"]["url"] = urlInfo.url; diff --git a/package.json b/package.json index 9a4d548..6fb35b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unblock-netease-music", - "version": "1.2.9", + "version": "2.0.0", "scripts": { "start": "node ./bin/www" }, @@ -8,7 +8,6 @@ "unblockneteasemusic": "bin/www" }, "dependencies": { - "async": "^2.0.0-rc.2", "co": "^4.6.0", "colors": "^1.1.2", "commander": "^2.9.0", diff --git a/server_config/nginx.conf.sample b/server_config/nginx.conf.sample new file mode 100644 index 0000000..12b3340 --- /dev/null +++ b/server_config/nginx.conf.sample @@ -0,0 +1,53 @@ +server { + listen 80; + server_name music.163.com; + resolver 114.114.114.114; + + location /* { + if ($http_host !~* ^(music.163.com)$){ + return 500; + } + } + + location / { + proxy_pass http://music.163.com; + proxy_next_upstream error timeout invalid_header http_500; + proxy_connect_timeout 6s; + proxy_send_timeout 6s; + proxy_read_timeout 6s; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Accept-Encoding ""; + subs_filter_types *; + subs_filter '"st":-.+?,' '"st":0,' ir; + subs_filter '"pl":0' '"pl":320000'; + subs_filter '"dl":0' '"dl":320000'; + subs_filter '"sp":0' '"sp":7'; + subs_filter '"cp":0' '"cp":1'; + subs_filter '"subp":0' '"subp":1'; + subs_filter '"fl":0' '"fl":320000'; + subs_filter '"fee":.+?,' '"fee":0,' ir; + subs_filter '"abroad":1,' ''; + } + + location /eapi/song/enhance/player/url { + proxy_pass http://localhost:8123; + } + + location /eapi/song/enhance/download/url { + proxy_pass http://localhost:8123; + } + + location /kugou { + rewrite '^/kugou/(.*)' /$1 break; + proxy_pass http://fs.web.kugou.com; + proxy_set_header Host fs.web.kugou.com; + } + + location /qqmusic { + rewrite '^/qqmusic/(.*)' /$1 break; + proxy_pass http://tsmusic24.tc.qq.com; + proxy_set_header "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"; + proxy_set_header Host tsmusic24.tc.qq.com; + } +} diff --git a/server_config/sniproxy.conf.sample b/server_config/sniproxy.conf.sample new file mode 100644 index 0000000..074e87a --- /dev/null +++ b/server_config/sniproxy.conf.sample @@ -0,0 +1,22 @@ +user daemon +pidfile /var/run/sniproxy.pid + +error_log { + syslog daemon + priority notice +} + +listen :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 +} \ No newline at end of file