proxy getter

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
}