Documentation has been updated: see help center and changelog in one place.

Proxy Endpoint

通过 Oxylabs 网页爬虫 API 的 Proxy Endpoint 发送和接收数据。通过简单的基于 URL 的集成直接访问目标页面。

如果您曾使用常规代理进行数据抓取,集成 Proxy Endpoint 交付方式将非常简单。您所需做的只是将我们的入口节点作为代理,使用 Scraper API 凭据进行授权,并忽略证书。在 cURL中,使用的是 -k--insecure。您的数据将通过开放连接传递给您。

Proxy Endpoint 仅适用于基于 URL 的数据源,其中提供完整的 URL。因此,它只接受少量额外的作业参数,这些参数 应作为头部发送.

端点

GET realtime.oxylabs.io:60000

输入

请参见下面的请求示例。

curl -k -x https://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,您还可以向我们发送一些我们在执行作业时会使用的作业参数。作业参数应作为请求头发送 - 请参见示例 此处.

以下是您可以随 Proxy Endpoint 请求一起发送的作业参数列表:

参数
说明

x-oxylabs-user-agent-type

无法指明特定的 User-Agent,但您可以告知我们希望使用哪种 user-agent 类型。受支持的 User-Agent 类型列表可在 此处.

x-oxylabs-geo-location

在某些情况下,您可能需要指明结果应针对的地理位置。此参数对应于 geo_location 参数,在源级文档中单独描述。可接受的值取决于您希望我们抓取的 URL。阅读更多 此处.

x-oxylabs-render

JavaScript 执行。阅读更多 此处.

最后更新于

这有帮助吗?