When I load the page "http://proxydb.net" using cURL, or try to scrape the page, then the response body is empty - 因为这个特定的网站使用用户代理白名单,如果您的用户代理不在白名单上,您只会得到一个空白页面。据推测,所有主要的网络浏览器都被列入白名单(Chrome、Internet Explorer、Edge、Safari、Opera 等),但这里有一个被列入白名单的特定用户代理:
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
(在 windows 7 x64 上运行的 Chrome 65 的用户代理),因此,这是有效的:
curl 'http://proxydb.net/' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'
至于如何动态加载内容,通常使用XMLHttpRequests 或在较旧的代码中,iframe 完成。
Apparently, the page is dynamically loaded using JavaScript. - 错了,这些家伙没有动态加载代理列表,它们直接嵌入到首页(只要您使用的是列入白名单的用户代理),被隐藏为
var q = '42.86.831'.split('').reverse().join('');
var yy = /* */ atob('\x4d\x43\x34\x79\x4d\x54\x67\x3d'.replace(/\\x([0-9A-Fa-f]{2})/g, function() {
return String.fromCharCode(parseInt(arguments[1], 16))
}));
var pp = (3109 - ([] + [])) /**/ + (+document.querySelector('[data-numr]').getAttribute('data-numr')) - [] + [];
document.write('<a href="/' + q + yy + '/' + pp + '#http">' + q + yy + String.fromCharCode(58) + pp + '</a>');
(在这种情况下,它与 data-numr div 一起转换为 138.68.240.218:3128 - 它实际上是加密的,解密密钥在一个看起来像 <div style="display:none" data-numr="19"></div> 的 div 中,这里的密钥是 19。)