photon
1/28/2017 - 5:51 AM

PAC to get those online video I need

PAC to get those online video I need

// Works at least for Chrome 47.0 (64-bit)

// White list, which doesn't go through proxy
var domains = {
  "127.0.0.1": 1, 
  "localhost": 1, 
  "evernote.com": 1, 
  "captora.com": 1, 
  "yinxiang.com": 1, 
  "acgvideo.com": 1, 
  "bilibili.com": 1, 
  "biligame.net": 1, 
  "hdslb.com": 1, 
  "ourdvsss.com": 1, 
  "youku.com": 1, 
  "ykimg.com": 1, 
  "soku.com": 1, 
  "119.167.222.79": 1, 
  "116.211.115.25": 1, 
  "116.211.115.50": 1, 
  "103.38.56.129": 1, 
  "118.180.19.73": 1, 
  "101.227.10.22": 1, 
  "alicdn.com": 1, 
  "109.105.109.165": 1, 
  "192.95.36.142": 1, 
  "154.35.22.9": 1, 
  "1-apple.com.tw": 1
};

// var proxy = "SOCKS5 127.0.0.1:2044;SOCKS 127.0.0.1:1080;DIRECT;";
var proxy = "SOCKS5 127.0.0.1:2044;";

var direct = 'DIRECT;';

function FindProxyForURL(url, host) {
    // all the ip addresses goes to direct connection
    var rx=/^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|$)){4}$/;
    if (rx.test(host)) {
       return direct;
    }

    var lastPos = 0;
    var domain = host;
  
    while(lastPos >= 0) {
        if (domains[domain]) {
//            return proxy;
           return direct;
        }
        lastPos = host.indexOf('.', lastPos + 1);
        domain = host.slice(lastPos + 1);
    }
//    return direct;
    return proxy;
}