Bright Data ChatGPT 搜索爬取器(Node.js)

在 CodeSandbox 打开,使用 GitHub 登录,然后 fork 该仓库开始修改。

本项目提供一个简单的 Node.js 模板,使用 Bright Data Web Scraper API 爬取 ChatGPT AI 搜索 的结果。


目录


概述

该仓库演示如何使用 Bright Data Scraper API 触发并下载 ChatGPT AI 搜索结果。包含示例提示词以及用于批量与自定义搜索的工具函数。


功能

  • 通过 Bright Data Scraper 的 /trigger API 端点触发 ChatGPT AI 搜索
  • 使用 /status 端点监控进度
  • 将结果下载并保存为 JSON

先决条件

  • Node.js v16 或更高版本
  • 拥有带 API KEY 的 Bright Data 账号

安装

sh 复制代码
git clone https://github.com/your-org/bright-data-scrape-chatgpt-search-nodejs-project.git
cd bright-data-scrape-chatgpt-search-nodejs-project
npm install

用法

  1. 设置你的 Bright Data API Token

    编辑 index.js 并设置你的 API Token:

    js 复制代码
    const API_TOKEN = 'YOUR_API_TOKEN_HERE';
  2. 运行爬取脚本

    sh 复制代码
    node index.js

    结果会以带时间戳的 .json 文件保存在项目目录中。


配置

  • API Token:

    在 Bright Data 控制台的账户设置中获取你的 API Token。

  • 数据集 ID(Dataset ID):

    ChatGPT AI Search 的默认数据集 ID 已在 index.js 中设置好。


示例

运行示例搜索

脚本默认会执行三个示例提示词:

js 复制代码
const SAMPLE_SEARCHES = [
  { url: "https://chatgpt.com/", prompt: "Top hotels in New York", country: "" ],
  { url: "https://chatgpt.com/", prompt: "What are the biggest business trends to watch in the next five years?", country: "" ],
  { url: "https://chatgpt.com/", prompt: "Best practices for remote team management", country: "" }
];

自定义搜索

在 index.js 中取消注释并修改以下内容以运行你自己的提示词:

js 复制代码
const customSearch = [createSearch("Best programming languages to learn in 2024")];
const customResults = await searchChatGPT(customSearch);
await saveResults(customResults, 'custom_search.json');

批量搜索

js 复制代码
const multipleSearches = [
  createSearch("Climate change solutions"),
  createSearch("AI ethics guidelines"),
  createSearch("Sustainable business practices")
];
const multiResults = await searchChatGPT(multipleSearches);
await saveResults(multiResults, 'multiple_searches.json');

输出

  • 结果将保存为 JSON 文件(例如 chatgpt_results_YYYY-MM-DDTHH-MM-SS.json)。
  • 每个文件包含来自 Bright Data 的原始 API 响应。

支持


许可证

本项目基于 MIT 许可证发布。详情见 。

相关推荐
重生之高冷汉堡包1 小时前
2026 ChatGPT广告投放实操教程:从Ads Manager搭建到高转化闭环
人工智能·安全·ai·chatgpt·内容运营
死磕音视频2 小时前
ChatGPT 应用与插件入门:连接 Google Drive 并在对话中调用
chatgpt·插件·办公效率·应用连接
仙逆GPT3 小时前
ChatGPT、Codex工程实战:Agent把OFFSET分页改成游标分页,查询更快了,为什么数据反而会重复和丢失?
mysql·chatgpt·codex·chatgptplus·chatgptpro
守城小轩3 小时前
Chromium 149 编译指南 Windows篇:环境变量配置(四)
chatgpt·codex·指纹浏览器
承渊政道16 小时前
【大模型应用开发:基于GPT-4和ChatGPT】(使用GPT-4和ChatGPT构建应用程序)
chatgpt·gpt-4·api调用·大模型应用开发·提示词设计
Ai-_Man1 天前
ChatGPT还是不可以导出左侧所有对话,只能点进去单条内容导出,方法不对吗?
开发语言·javascript·人工智能·chatgpt·小程序·ecmascript
king13598745501 天前
LiteRT Tensor API:C++ 编写端侧模型图,XNNPACK、GPU 与 NPU 怎么选?
开发语言·c++·人工智能·chatgpt·架构·aigc
ServBay2 天前
写代码到底用哪个 AI 不花冤枉钱?最贵和最便宜差了250倍
chatgpt·claude·deepseek
ClouGence2 天前
最全AI电商生图工具测评:豆包、千问、ChatGPT、WorkBuddy、Nano Banana、即梦、美图设计室、阿可AI
chatgpt·aigc·gemini