Scrape and Extract Web Data with Bright Data
Bright Data Tool lets a LlamaIndex agent scrape pages, screenshot sites, search engines, and pull structured data from platforms.
Why it matters
Leverage Bright Data's robust web scraping capabilities to reliably extract structured data from websites, search engines, and social media platforms, bypassing CAPTCHA and bot detection.
Outcomes
What it gets done
Scrape web pages and convert content to Markdown, bypassing bot detection.
Take screenshots of web pages for visual capture.
Perform targeted web searches on Google, Bing, or Yandex with structured results.
Extract structured data from platforms like LinkedIn, Amazon, and social media.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-brightdata | bash Overview
LlamaIndex Tools Integration: Bright Data
Bright Data Tool is a LlamaIndex ToolSpec exposing scrape_as_markdown, get_screenshot, search_engine, and web_data_feed functions, using Bright Data's CAPTCHA-solving and bot-detection-avoidance infrastructure. Use it when an agent needs reliable web scraping, screenshots, search-engine results, or structured platform data that a naive scraper would get blocked from.
What it does
Bright Data Tool is a LlamaIndex ToolSpec that connects to Bright Data, giving an agent the ability to crawl websites, search the web, and access structured data from platforms like LinkedIn, Amazon, and social media. Bright Data's own infrastructure provides the underlying web-scraping reliability - built-in CAPTCHA solving and bot-detection avoidance - so the tool can extract data from sites that would otherwise block a naive scraper.
When to use - and when NOT to
Use this when an agent needs to reliably pull content from the live web - converting a page to clean Markdown, taking a visual screenshot, running a structured search across Google, Bing, or Yandex, or retrieving structured profile/product data from platforms like LinkedIn or Amazon - especially where CAPTCHA or bot detection would block a simpler scraping approach. It requires a Bright Data account and API key (a specific zone, e.g. "unlocker", is also configured), so it is not usable without that account set up.
Inputs and outputs
Four functions are exposed: scrape_as_markdown(url), which scrapes a webpage and converts it to Markdown, bypassing CAPTCHA and bot detection; get_screenshot(url, output_path), which captures a screenshot of a webpage to a file; search_engine(query, engine, language, country_code, num_results, search_type, device, ...), which searches Google, Bing, or Yandex and returns structured JSON or Markdown results, supporting advanced parameters like language/country targeting, search type (images, shopping, news), pagination, mobile emulation, geolocation, and hotel-search parameters; and web_data_feed(source_type, url), which retrieves structured data from platforms including LinkedIn, Amazon, Instagram, Facebook, X (Twitter), and Zillow.
Integrations
Installed via pip install llama-index llama-index-core llama-index-tools-brightdata, requiring a Bright Data account and API key from the account settings, then imported as BrightDataToolSpec from llama_index.tools.brightdata and wired into a FunctionAgent alongside an LLM such as OpenAI's.
Who it's for
Developers building LlamaIndex agents that need reliable web scraping, screenshotting, search-engine access, or structured platform data (LinkedIn, Amazon, social media) without building their own CAPTCHA-solving and bot-detection-avoidance layer.
The project's own usage example shows a pattern worth noting: it rewrites each tool's exposed description to a short generic label ("Bright Data web scraping tool") while preserving the original detailed description separately, then feeds both back into the agent's prompt alongside the actual query - a way of keeping the tool list compact for the LLM while still surfacing the fuller per-tool documentation when it is useful for the model to see.
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.brightdata import BrightDataToolSpec
brightdata_tool = BrightDataToolSpec(api_key="your-api-key", zone="unlocker")
Source README
LlamaIndex Tools Integration: Bright Data
This tool connects to Bright Data to enable your agent to crawl websites, search the web, and access structured data from platforms like LinkedIn, Amazon, and social media.
Bright Data's tools provide robust web scraping capabilities with built-in CAPTCHA solving and bot detection avoidance, allowing you to reliably extract data from the web.
Installation
pip install llama-index llama-index-core llama-index-tools-brightdata
Authentication
Sign up at Bright Data and retrieve your API key from your account settings. Replace "your-api-key" with your actual API key in the examples below:
Usage
Here's an example of how to use the BrightDataToolSpec with LlamaIndex:
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.brightdata import BrightDataToolSpec
brightdata_tool = BrightDataToolSpec(api_key="your-api-key", zone="unlocker")
tool_list = brightdata_tool.to_tool_list()
for tool in tool_list:
tool.original_description = tool.metadata.description
tool.metadata.description = "Bright Data web scraping tool"
agent = FunctionAgent(
tools=tool_list,
llm=OpenAI(model="gpt-4.1"),
)
query = (
"Find and summarize the latest news about AI from major tech news sites"
)
tool_descriptions = "\n\n".join(
[
f"Tool Name: {tool.metadata.name}\nTool Description: {tool.original_description}"
for tool in tool_list
]
)
query_with_descriptions = f"{tool_descriptions}\n\nQuery: {query}"
response = await agent.run(query_with_descriptions)
print(response)
Features
The Bright Data tool provides the following capabilities:
Web Scraping
scrape_as_markdown: Scrape a webpage and convert the content to Markdown format. This tool can bypass CAPTCHA and bot detection.
result = brightdata_tool.scrape_as_markdown("https://example.com")
print(result.text)
Visual Capture
get_screenshot: Take a screenshot of a webpage and save it to a file.
screenshot_path = brightdata_tool.get_screenshot(
"https://example.com", output_path="example_screenshot.png"
)
Search Engine Access
search_engine: Search Google, Bing, or Yandex and get structured search results as JSON or Markdown. Supports advanced parameters for more specific searches.
search_results = brightdata_tool.search_engine(
query="climate change solutions",
engine="google",
language="en",
country_code="us",
num_results=20,
)
print(search_results.text)
Structured Web Data Extraction
web_data_feed: Retrieve structured data from various platforms including LinkedIn, Amazon, Instagram, Facebook, X (Twitter), Zillow, and more.
linkedin_profile = brightdata_tool.web_data_feed(
source_type="linkedin_person_profile",
url="https://www.linkedin.com/in/username/",
)
print(linkedin_profile)
amazon_product = brightdata_tool.web_data_feed(
source_type="amazon_product", url="https://www.amazon.com/dp/B08N5KWB9H"
)
print(amazon_product)
Advanced Configuration
The Bright Data tool offers various configuration options for specialized use cases:
Search Engine Parameters
The search_engine function supports advanced parameters like:
- Language targeting (
languageparameter) - Country-specific search (
country_codeparameter) - Different search types (images, shopping, news, etc.)
- Pagination controls
- Mobile device emulation
- Geolocation targeting
- Hotel search parameters
results = brightdata_tool.search_engine(
query="best hotels in paris",
engine="google",
language="fr",
country_code="fr",
search_type="shopping",
device="mobile",
hotel_dates="2025-06-01,2025-06-05",
hotel_occupancy=2,
)
Supp
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.