Browserbase 加载器
¥Browserbase Loader
说明
¥Description
Browserbase 是一个开发者平台,可以可靠地运行、管理和监控无头浏览器。
¥Browserbase is a developer platform to reliably run, manage, and monitor headless browsers.
使用以下工具为你的 AI 数据检索提供支持:
¥Power your AI data retrievals with:
无服务器基础设施 提供可靠的浏览器,可从复杂的 UI 中提取数据。
¥Serverless Infrastructure providing reliable browsers to extract data from complex UIs
隐身模式 包含指纹识别策略和自动验证码解决功能
¥Stealth Mode with included fingerprinting tactics and automatic captcha solving
会话调试器 使用网络时间线和日志检查你的浏览器会话
¥Session Debugger to inspect your Browser Session with networks timeline and logs
实时调试 快速调试你的自动化功能
¥Live Debug to quickly debug your automation
安装
¥Installation
从 browserbase.com 获取 API 密钥和项目 ID,并将其设置为环境变量(
BROWSERBASE_API_KEY、BROWSERBASE_PROJECT_ID)。¥Get an API key and Project ID from browserbase.com and set it in environment variables (
BROWSERBASE_API_KEY,BROWSERBASE_PROJECT_ID).安装 Browserbase SDK:
¥Install the Browserbase SDK:
- npm
- Yarn
- pnpm
npm i @langchain/community @langchain/core @browserbasehq/sdk
yarn add @langchain/community @langchain/core @browserbasehq/sdk
pnpm add @langchain/community @langchain/core @browserbasehq/sdk
示例
¥Example
按如下方式利用 BrowserbaseLoader 让你的代理加载网站:
¥Utilize the BrowserbaseLoader as follows to allow your agent to load websites:
import { BrowserbaseLoader } from "@langchain/community/document_loaders/web/browserbase";
const loader = new BrowserbaseLoader(["https://example.com"], {
textContent: true,
});
const docs = await loader.load();
API Reference:
- BrowserbaseLoader from
@langchain/community/document_loaders/web/browserbase
参数
¥Arguments
urls:必需。要加载的 URL 列表。¥
urls: Required. List of URLs to load.
选项
¥Options
textContent仅检索文本内容。默认为false。¥
textContentRetrieve only text content. Default isfalse.sessionId可选。提供现有的会话 ID。¥
sessionIdOptional. Provide an existing Session ID.proxy可选。启用/禁用代理。¥
proxyOptional. Enable/Disable Proxies.