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 许可证发布。详情见 。

相关推荐
Spidermanbaout2 天前
Prompt-Engineering实战-2026年11月2日
人工智能·机器学习·ai·chatgpt·ai编程
ServBay2 天前
OpenAI大规模封号?ChatGPT 用户该如何应对
chatgpt·openai·ai编程
长不大的杨瑞杰2 天前
ChatGPT 广告技术栈架构拆解:多轮意图、LLM 工具编排、ANN 召回与拍卖闭环
人工智能·chatgpt·系统架构·推荐系统·广告
AI砖家3 天前
ChatGPT Images 2.6 正式支持 GIF 生成:一张图片也能动起来,AI 动图创作时代来了!
人工智能·chatgpt
看浪的路人3 天前
第3讲:输出安全——PII 脱敏与有害内容过滤
chatgpt
冯智勇Geo4 天前
看书不如聊书:分享一种新的 AI 阅读方式
chatgpt·ai阅读
叼烟扛炮4 天前
[LangChain] 学习笔记(04):手搓 ChatGPT 打字机——流式输出(SSE)与模型初始化选型
人工智能·笔记·chatgpt·langchain
xiaoye-duck6 天前
《C++ 项目:手写大模型接入 SDK》ChatGPT接口设计(下):流式响应实现和测试
网络·c++·语言模型·chatgpt
奈落247 天前
Codex 并进 ChatGPT 之后,“编程智能体“是变浅了还是变顺了:从官方概览页的功能分工到五家公司开发者反馈,读一次产品化合并的得与失
人工智能·chatgpt·工作流·ai 编程
xiaoye-duck7 天前
《C++ 项目:手写大模型接入 SDK》ChatGPT接口设计(中):全量响应实现和测试
网络·c++·语言模型·chatgpt