Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.brightdata.com/llms.txt

Use this file to discover all available pages before exploring further.

中文翻译

本教程展示了如何向 ChatGPT 发送搜索提示,并使用 Bright Data ChatGPT Scraper API 获取结构化 JSON 数据。

前置条件

  • 一个 Bright Data 账户(包含 $2 免费信用额)
  • 已安装 cURL、Python 3 或 Node.js 18+
1

获取您的 API 密钥

转到您 Bright Data 账户中的用户设置页面并复制您的 API 密钥。如果您还没有账户,请在 brightdata.com 上注册。新用户可获得 $2 免费信用额用于测试。
您的 API 密钥仅在创建时显示一次。请复制并安全地存储它。
2

发送请求

我们将使用ChatGPT 搜索端点进行同步请求。将 YOUR_API_KEY 替换为您的实际密钥:
curl -X POST \
  "https://api.brightdata.com/datasets/v3/scrape?dataset_id=gd_m7aof0k82r803d5bjm&format=json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '[{"url": "https://chatgpt.com/", "prompt": "Top hotels in New York"}]'
您应该看到 200 状态代码。这需要 15-45 秒。
3

查看响应

Bright Data ChatGPT Scraper API 返回一个包含结构化搜索数据的 JSON 数组:
[
  {
    "url": "https://chatgpt.com/",
    "prompt": "Top hotels in New York",
    "answer_text": "Here are some of the top-rated hotels in New York City...",
    "model": "gpt-4o",
    "web_search_triggered": true,
    "citations": [
      {
        "title": "Best Hotels in NYC - Travel Guide",
        "url": "https://example.com/nyc-hotels",
        "position": 1
      }
    ],
    "search_sources": [
      {
        "url": "https://example.com/nyc-hotels",
        "title": "Best Hotels in NYC - Travel Guide"
      }
    ],
    "prompt_sent_at": "2026-04-08T12:00:00.000Z"
  }
]
每个结果对象都包含答案文本、带有源 URL 的引用和元数据。请参阅完整响应模式
您已成功使用 Bright Data ChatGPT Scraper API 通过首个提示搜索了 ChatGPT。

常见问题

可以。将更多对象添加到输入数组。同步请求最多支持 20 个输入。对于更大的批次,请使用异步 /trigger 端点
[
  {"url": "https://chatgpt.com/", "prompt": "Top hotels in New York"},
  {"url": "https://chatgpt.com/", "prompt": "Best restaurants in Paris"},
  {"url": "https://chatgpt.com/", "prompt": "Things to do in Tokyo"}
]
验证您的 API 密钥是否正确且未过期。从账户设置生成新密钥。有关详情,请参阅身份验证指南
同步请求的超时时间为 1 分钟。如果请求超过此限制,它会自动切换到异步模式并返回 snapshot_id。对于大批次,请使用异步工作流
验证 url 字段是否设置为 https://chatgpt.com/,且 prompt 字段不为空。提示内容必须为 4,096 个字符或更少。

后续步骤

发送您的第一个请求

探索包含完整代码示例的输入选项。

异步批量请求

在单个批处理作业中使用数百个提示搜索 ChatGPT。

设置 Webhook

在爬取完成时自动接收结果。