Bright Data는 안티봇 조치, 지역 제한 또는 기타 접근 제한으로 보호될 수 있는 웹사이트에 액세스할 수 있는 강력한 Web Unlocker API를 제공하며, 신뢰할 수 있는 웹 콘텐츠 추출이 필요한 AI 에이전트에 특히 유용합니다.

Overview

Integration details

ClassPackageSerializableJS supportVersion
BrightDataUnlockerlangchain-brightdataPyPI - Version

Tool features

Native asyncReturns artifactReturn dataPricing
웹 페이지의 HTML, Markdown 또는 스크린샷Bright Data 계정 필요

Setup

이 통합은 langchain-brightdata 패키지에 포함되어 있습니다.
pip install langchain-brightdata
이 도구를 사용하려면 Bright Data API 키가 필요합니다. 환경 변수로 설정할 수 있습니다:
import os

os.environ["BRIGHT_DATA_API_KEY"] = "your-api-key"
또는 도구를 초기화할 때 직접 전달할 수 있습니다:
from langchain_brightdata import BrightDataUnlocker

unlocker_tool = BrightDataUnlocker(bright_data_api_key="your-api-key")

Instantiation

여기서는 BrightDataUnlocker 도구의 인스턴스를 생성하는 방법을 보여줍니다. 이 도구를 사용하면 Bright Data의 Web Unlocker 서비스를 사용하여 안티봇 조치, 지역 제한 또는 기타 접근 제한으로 보호될 수 있는 웹사이트에 액세스할 수 있습니다. 이 도구는 인스턴스화 시 다양한 매개변수를 허용합니다:
  • bright_data_api_key (필수, str): 인증을 위한 Bright Data API 키입니다.
  • format (선택, Literal[“raw”]): 응답 콘텐츠의 형식입니다. 기본값은 “raw”입니다.
  • country (선택, str): 지역별 액세스를 위한 두 글자 국가 코드입니다 (예: “us”, “gb”, “de”, “jp”). 특정 국가에서 액세스하는 것처럼 웹사이트를 보려면 이 값을 설정하세요. 기본값은 None입니다.
  • zone (선택, str): 요청에 사용할 Bright Data zone입니다. “unlocker” zone은 일반 요청을 차단할 수 있는 웹사이트에 액세스하는 데 최적화되어 있습니다. 기본값은 “unlocker”입니다.
  • data_format (선택, Literal[“html”, “markdown”, “screenshot”]): 검색된 콘텐츠의 출력 형식입니다. 옵션은 다음과 같습니다:
    • “html” - 표준 HTML 콘텐츠를 반환합니다 (기본값)
    • “markdown” - 마크다운 형식으로 변환된 콘텐츠를 반환합니다
    • “screenshot” - 렌더링된 페이지의 PNG 스크린샷을 반환합니다

Invocation

기본 사용법

from langchain_brightdata import BrightDataUnlocker

# Initialize the tool
unlocker_tool = BrightDataUnlocker(
    bright_data_api_key="your-api-key"  # Optional if set in environment variables
)

# Access a webpage
result = unlocker_tool.invoke("https://example.com")

print(result)

매개변수를 사용한 고급 사용법

from langchain_brightdata import BrightDataUnlocker

unlocker_tool = BrightDataUnlocker(
    bright_data_api_key="your-api-key",
)

# Access a webpage with specific parameters
result = unlocker_tool.invoke(
    {
        "url": "https://example.com/region-restricted-content",
        "country": "gb",  # Access as if from Great Britain
        "data_format": "html",  # Get content in markdown format
        "zone": "unlocker",  # Use the unlocker zone
    }
)

print(result)

Customization Options

BrightDataUnlocker 도구는 커스터마이징을 위한 여러 매개변수를 허용합니다:
ParameterTypeDescription
urlstr액세스할 URL
formatstr응답 콘텐츠의 형식 (기본값: “raw”)
countrystr지역별 액세스를 위한 두 글자 국가 코드 (예: “us”, “gb”)
zonestr사용할 Bright Data zone (기본값: “unlocker”)
data_formatstr출력 형식: None (HTML), “markdown” 또는 “screenshot”

Data Format Options

data_format 매개변수를 사용하면 콘텐츠가 반환되는 방식을 지정할 수 있습니다:
  • None 또는 "html" (기본값): 페이지의 표준 HTML 콘텐츠를 반환합니다
  • "markdown": 마크다운 형식으로 변환된 콘텐츠를 반환하며, LLM에 직접 제공하는 데 유용합니다
  • "screenshot": 렌더링된 페이지의 PNG 스크린샷을 반환하며, 시각적 분석에 유용합니다

Use within an agent

from langchain_brightdata import BrightDataUnlocker
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain.agents import create_agent


# Initialize the LLM
llm = ChatGoogleGenerativeAI(model="gemini-2.5-flash", google_api_key="your-api-key")

# Initialize the tool
bright_data_tool = BrightDataUnlocker(bright_data_api_key="your-api-key")

# Create the agent
agent = create_agent(llm, [bright_data_tool])

# Input URLs or prompt
user_input = "Get the content from https://example.com/region-restricted-page - access it from GB"

# Stream the agent's output step by step
for step in agent.stream(
    {"messages": user_input},
    stream_mode="values",
):
    step["messages"][-1].pretty_print()

API reference


Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I