proxy getter

从代理表中获取代理 ip:port 列表

Verze ze dne 02. 09. 2016. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         proxy getter
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  从代理表中获取代理 ip:port 列表
// @author       me10zyl
// @match        http://www.proxynova.com/proxy-server-list/*
// @match        http://cn-proxy.com/*
// @match        http://www.kuaidaili.com/*
// @grant        none
// @require      https://code.jquery.com/jquery-1.12.4.min.js
// ==/UserScript==

var selectors = ["#tbl_proxy_list",".table-container", "#index_free_list"];
(function() {

    // Your code here...

    for(var i in selectors){
        if($(selectors[i]).length <= 0){
            continue;
        }
        $(selectors[i]).before("<button id='copy_btn_1234'>复制这些代理地址</button>");
        $("#copy_btn_1234").click(function(){
            catchProxies();
        });
    }

    $(document).keypress(function(e){
        if(e.which == 55){
            catchProxies();
        }
    });
})();

function catchProxies(){
    var ips = [];
    console.log("start fetch proxy ips...");
    for(var i in selectors){
        if($(selectors[i]).length <= 0){
            continue;
        }
        $(selectors[i] + " tr").each(function(){
            var ip = $(this).find("td:first-child").text().trim();
            var port = $(this).find("td:nth-child(2)").text().trim();
            if(!/\s+/.test(port)){
                var str = ip + ":" + port;
                console.log(str);
                ips.push(str);
            }
        });
    }
    var alertstr = "";
    for(var j in ips){
        alertstr += ips[j] + "\n";
    }
    copyToClipboard(alertstr);
}


function copyToClipboard(text){
        window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
}