代理端口

总览

如果您曾经使用过普通代理执行数据抓取,集成代理端点交付方式将是一件轻而易举的事。您需要做的就是使用我们的输入节点作为代理,用爬虫API 凭据进行验证并忽略证书。在 cURL 中,它是 -k--insecure。数据将在同一个开放的连接上到达您的手中。

代理端点只适用于基于 URL 的数据源,其中提供了完整 URL。因此,它只接受少数额外的作业参数,这些参数应作为标头发送

端点

GET realtime.oxylabs.io:60000

输入

请查看以下请求示例。

curl -k -x realtime.oxylabs.io:60000 \
-U USERNAME:PASSWORD \
-H "x-oxylabs-user-agent-type: desktop_chrome" \
-H "x-oxylabs-geo-location: Germany" \
'https://www.example.com'

输出

下面您将看到一个来自 https://example.com 的回复样本:

<!doctype html>
<html>
<head>
    <title>Example Domain</title>

    <meta charset="utf-8" />
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <style type="text/css">
    body {
        background-color: #f0f0f2;
        margin: 0;
        padding: 0;
        font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
        
    }
    div {
        width: 600px;
        margin: 5em auto;
        padding: 2em;
        background-color: #fdfdff;
        border-radius: 0.5em;
        box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);
    }
    a:link, a:visited {
        color: #38488f;
        text-decoration: none;
    }
    @media (max-width: 700px) {
        div {
            margin: 0 auto;
            width: auto;
        }
    }
    </style>    
</head>

<body>
<div>
    <h1>Example Domain</h1>
    <p>This domain is for use in illustrative examples in documents. You may use this
    domain in literature without prior coordination or asking for permission.</p>
    <p><a href="https://www.iana.org/domains/example">More information...</a></p>
</div>
</body>
</html>

接受参数

在提出请求(连同 URL)时,您可以向我们发送一些我们将在执行您的作业时使用的工作参数。工作参数应该在您的请求表头中发送 - 请参阅此处的示例。

下面是您可以用代理端点请求发送的作业参数列表:

参数描述

x-oxylabs-user-agent-type

没有办法表明具体的用户代理,但您可以让我们知道使用哪个浏览器和平台。单击此处查看支持用户代理类型的列表。

x-oxylabs-geo-location

在某些情况下,您可能需要指出该结果应适应的地理位置。这个参数对应的是 geo_location 参数,在源码级文件中单独描述。接受的值取决于您希望我们抓取的 URL。

x-oxylabs-render

JavaScript 执行。此处阅读更多信息。

最后更新于