|
| 1 | +// Based on Unblock-Youku project |
| 2 | +// https://github.com/zhuzhuor/Unblock-Youku/blob/master/shared/urls.js |
| 3 | + |
| 4 | +function FindProxyForURL(url, host) { |
| 5 | + var PROXY = 'SOCKS 127.0.0.1:1983'; |
| 6 | + var rules = [ |
| 7 | + // for both chrome extension and server |
| 8 | + [ |
| 9 | + 'http://v.youku.com/player/*', |
| 10 | + 'http://api.youku.com/player/*', |
| 11 | + 'http://v2.tudou.com/*', |
| 12 | + 'http://www.tudou.com/a/*', |
| 13 | + 'http://www.tudou.com/v/*', |
| 14 | + 'http://www.tudou.com/outplay/goto/getTvcCode*', |
| 15 | + 'http://www.tudou.com/tvp/alist.action*', |
| 16 | + 'http://s.plcloud.music.qq.com/fcgi-bin/p.fcg*', |
| 17 | + 'http://hot.vrs.sohu.com/*', |
| 18 | + 'http://live.tv.sohu.com/live/player*', |
| 19 | + 'http://hot.vrs.letv.com/*', |
| 20 | + //'http://g3.letv.cn/*', |
| 21 | + 'http://data.video.qiyi.com/*', |
| 22 | + |
| 23 | + // cause oversea servers unusable? |
| 24 | + // 'http://interface.bilibili.tv/player*', |
| 25 | + |
| 26 | + 'http://220.181.61.229/*', |
| 27 | + 'http://61.135.183.45/*', |
| 28 | + 'http://61.135.183.46/*', |
| 29 | + 'http://220.181.19.218/*', |
| 30 | + 'http://220.181.61.212/*', |
| 31 | + 'http://220.181.61.213/*', |
| 32 | + 'http://220.181.118.181/*', |
| 33 | + 'http://123.126.48.47/*', |
| 34 | + 'http://123.126.48.48/*', |
| 35 | + |
| 36 | + 'http://vv.video.qq.com/*', |
| 37 | + 'http://tt.video.qq.com/getinfo*', |
| 38 | + 'http://ice.video.qq.com/getinfo*', |
| 39 | + 'http://tjsa.video.qq.com/getinfo*', |
| 40 | + 'http://a10.video.qq.com/getinfo*', |
| 41 | + 'http://xyy.video.qq.com/getinfo*', |
| 42 | + 'http://vcp.video.qq.com/getinfo*', |
| 43 | + 'http://vsh.video.qq.com/getinfo*', |
| 44 | + 'http://vbj.video.qq.com/getinfo*', |
| 45 | + 'http://bobo.video.qq.com/getinfo*', |
| 46 | + 'http://flvs.video.qq.com/getinfo*', |
| 47 | + 'http://rcgi.video.qq.com/report*', |
| 48 | + |
| 49 | + 'http://geo.js.kankan.xunlei.com/*', |
| 50 | + 'http://web-play.pptv.com/*', |
| 51 | + 'http://web-play.pplive.cn/*', |
| 52 | + // 'http://c1.pptv.com/*', |
| 53 | + 'http://dyn.ugc.pps.tv/*', |
| 54 | + 'http://v.pps.tv/ugc/ajax/aj_html5_url.php*', |
| 55 | + 'http://inner.kandian.com/*', |
| 56 | + 'http://ipservice.163.com/*', |
| 57 | + 'http://so.open.163.com/open/info.htm*', |
| 58 | + 'http://zb.s.qq.com/*', |
| 59 | + 'http://ip.kankan.xunlei.com/*', |
| 60 | + 'http://vxml.56.com/json/*', |
| 61 | + |
| 62 | + 'http://music.sina.com.cn/yueku/intro/*', |
| 63 | + //'http://ting.baidu.com/data/music/songlink*', |
| 64 | + //'http://ting.baidu.com/data/music/songinfo*', |
| 65 | + //'http://ting.baidu.com/song/*/download*', |
| 66 | + 'http://music.sina.com.cn/radio/port/webFeatureRadioLimitList.php*', |
| 67 | + 'http://play.baidu.com/data/music/songlink*', |
| 68 | + |
| 69 | + 'http://v.iask.com/v_play.php*', |
| 70 | + 'http://v.iask.com/v_play_ipad.cx.php*', |
| 71 | + 'http://tv.weibo.com/player/*', |
| 72 | + 'http://wtv.v.iask.com/*.m3u8', |
| 73 | + 'http://wtv.v.iask.com/mcdn.php', |
| 74 | + 'http://video.sina.com.cn/interface/l/u/getFocusStatus.php*', |
| 75 | + |
| 76 | + //'http://kandian.com/player/getEpgInfo*', // !!! |
| 77 | + //'http://cdn.kandian.com/*', |
| 78 | + 'http://www.yinyuetai.com/insite/*', |
| 79 | + 'http://www.yinyuetai.com/main/get-*', |
| 80 | + |
| 81 | + 'http://*.dpool.sina.com.cn/iplookup*', |
| 82 | + 'http://*/vrs_flash.action*', |
| 83 | + 'http://*/?prot=2&type=1*', |
| 84 | + 'http://*/?prot=2&file=/*', |
| 85 | + 'http://api.letv.com/streamblock*', |
| 86 | + 'http://api.letv.com/mms/out/video/play*', |
| 87 | + 'http://api.letv.com/mms/out/common/geturl*', |
| 88 | + 'http://api.letv.com/geturl*', |
| 89 | + 'http://live.gslb.letv.com/gslb?*', |
| 90 | + 'http://vdn.apps.cntv.cn/api/get*', |
| 91 | + 'http://vip.sports.cntv.cn/check.do*', |
| 92 | + 'http://vip.sports.cntv.cn/play.do*', |
| 93 | + 'http://vip.sports.cntv.cn/servlets/encryptvideopath.do*', |
| 94 | + ], |
| 95 | + |
| 96 | + // only for server |
| 97 | + [ |
| 98 | + // for Mobile apps // Video apps |
| 99 | + 'http://api.3g.youku.com/layout*', |
| 100 | + 'http://api.3g.youku.com/v3/play/address*', |
| 101 | + 'http://api.3g.youku.com/openapi-wireless/videos/*/download*', |
| 102 | + 'http://api.3g.youku.com/videos/*/download*', |
| 103 | + 'http://api.3g.youku.com/common/v3/play*', |
| 104 | + 'http://tv.api.3g.youku.com/openapi-wireless/v3/play/address*', |
| 105 | + 'http://tv.api.3g.youku.com/common/v3/hasadv/play*', |
| 106 | + 'http://tv.api.3g.youku.com/common/v3/play*', |
| 107 | + 'http://play.api.3g.youku.com/common/v3/hasadv/play*', |
| 108 | + 'http://play.api.3g.youku.com/common/v3/play*', |
| 109 | + 'http://play.api.3g.youku.com/v3/play/address*', |
| 110 | + 'http://play.api.3g.tudou.com/v*', |
| 111 | + 'http://tv.api.3g.tudou.com/tv/play?*', |
| 112 | + 'http://api.3g.tudou.com/*', |
| 113 | + 'http://api.tv.sohu.com/mobile_user/device/clientconf.json?*', |
| 114 | + 'http://access.tv.sohu.com/*', |
| 115 | + 'http://iface2.iqiyi.com/php/xyz/iface/*', |
| 116 | + 'http://dynamic.app.m.letv.com/*/dynamic.php?*playid*', |
| 117 | + 'http://dynamic.meizi.app.m.letv.com/*/dynamic.php?*playid*', |
| 118 | + 'http://listso.m.areainfo.ppstream.com/ip/q.php*', |
| 119 | + 'http://api.letv.com/getipgeo', |
| 120 | + 'http://m.letv.com/api/geturl?*', |
| 121 | + 'http://vv.video.qq.com/getvinfo*', |
| 122 | + 'http://bkvv.video.qq.com/getvinfo*', |
| 123 | + // Music apps |
| 124 | + 'http://3g.music.qq.com/*', |
| 125 | + 'http://mqqplayer.3g.qq.com/*', |
| 126 | + 'http://proxy.music.qq.com/*', |
| 127 | + 'http://ip2.kugou.com/check/isCn/*', |
| 128 | + 'http://ip.kugou.com/check/isCn/*', |
| 129 | + 'http://client.api.ttpod.com/global*', |
| 130 | + 'http://mobi.kuwo.cn/*', |
| 131 | + 'http://mobilefeedback.kugou.com/*', |
| 132 | + 'http://tingapi.ting.baidu.com/v1/restserver/ting?*method=baidu.ting.song*', |
| 133 | + 'http://serviceinfo.sdk.duomi.com/api/serviceinfo/getserverlist*', |
| 134 | + 'http://music.163.com/api/copyright/restrict/?*', |
| 135 | + 'http://music.163.com/api/batch', |
| 136 | + 'http://spark.api.xiami.com/api?*method=Songs.getTrackDetail*', |
| 137 | + // for PC Clients only |
| 138 | + 'http://iplocation.geo.qiyi.com/cityjson', |
| 139 | + 'http://sns.video.qq.com/tunnel/fcgi-bin/tunnel*', |
| 140 | + 'http://v5.pc.duomi.com/single-ajaxsingle-isban*', |
| 141 | + 'https://openapi.youku.com/*', // see issue #118 |
| 142 | + 'https://61.135.196.99/*', //n-openapi.youku.com |
| 143 | + 'https://220.181.185.150/*', //zw-openapi.youku.com |
| 144 | + 'https://httpbin.org/get', // for testing |
| 145 | + // for MiBox iCNTV Authentication |
| 146 | + 'http://tms.is.ysten.com:8080/yst-tms/login.action?*', |
| 147 | + // for 3rd party's DNS for Apple TV (see pull request #78) |
| 148 | + 'http://180.153.225.136/*', |
| 149 | + 'http://118.244.244.124/*', |
| 150 | + 'http://210.129.145.150/*', |
| 151 | + 'http://182.16.230.98/*', //Updated on Jan. 3, for new DNS of apple tv. |
| 152 | + ] |
| 153 | + ]; |
| 154 | + var vurl = url.toLowerCase(); |
| 155 | + var rules_len = rules.length; |
| 156 | + for (var j = 0; j < rules_len; j++) { |
| 157 | + var rule_list = rules[j]; |
| 158 | + var rule_list_len = rule_list.length; |
| 159 | + for (var i = 0; i < rule_list_len; i++) { |
| 160 | + if (shExpMatch(vurl, rule_list[i])) { |
| 161 | + return PROXY; |
| 162 | + } |
| 163 | + } |
| 164 | + } |
| 165 | + return 'DIRECT'; |
| 166 | +} |
0 commit comments