Skip to main content
ScrapeGraphTools enable an Agent to extract structured data from webpages, convert content to markdown, and retrieve raw HTML content using the ScrapeGraphAI API. The toolkit provides 5 core capabilities:
  1. smartscraper: Extract structured data using natural language prompts
  2. markdownify: Convert web pages to markdown format
  3. searchscraper: Search the web and extract information
  4. crawl: Crawl websites with structured data extraction
  5. scrape: Get raw HTML content from websites (NEW!)
The scrape method is particularly useful when you need:
  • Complete HTML source code
  • Raw content for further processing
  • HTML structure analysis
  • Content that needs to be parsed differently
All methods support heavy JavaScript rendering when needed.

Prerequisites

The following examples require the scrapegraph-py library.
Optionally, if your ScrapeGraph configuration or specific models require an API key, set the SGAI_API_KEY environment variable:

Example

The following agent will extract structured data from a website using the smartscraper tool:
cookbook/14_tools/scrapegraph_tools.py

Raw HTML Scraping

Get complete HTML content from websites for custom processing:
cookbook/14_tools/scrapegraph_tools.py

All Functions with JavaScript Rendering

Enable all ScrapeGraph functions with heavy JavaScript support:
cookbook/14_tools/scrapegraph_tools.py

Toolkit Params

Toolkit Functions

Developer Resources