http(s) URL to remember(), control what gets extracted with CSS-selector rules, and visualize the result.
Before you start:
- Complete Quickstart to understand basic operations
- Install the scraping extra:
pip install cognee[scraping](BeautifulSoup, Tavily, Playwright)
Code in Action
Step 1: Define Extraction Rules
Extraction rules tell the BeautifulSoup loader which parts of the page to keep. Each rule maps a name to a CSS selector (or XPath):
Rules are optional — without them the loader applies a comprehensive default set covering common HTML content areas (headings, paragraphs, articles, tables, code blocks, etc.). See Loaders for more
preferred_loaders examples.
Step 2: Remember the URL
remember() recognizes the URL, fetches the page, extracts content according to your rules, and builds the knowledge graph in one call.
Step 3: Visualize the Result
Choosing a crawler
By default Cognee uses its built-in BeautifulSoup-based crawler, which supports asynchronous HTTP requests, robots.txt compliance, rate limiting, and Playwright rendering for JavaScript-heavy pages. SetTAVILY_API_KEY in your environment to use the Tavily API instead for richer extraction from complex pages. See Python API: add() for the crawler configuration options (tavily_config, soup_crawler_config).
Full Example
The script is available on our github. The complete flow — forget, remember a URL with extraction rules, and visualize — is in the following example:Web URL content ingestion
Web URL content ingestion
Loaders
How Cognee turns files and pages into ingestable content
Graph Visualization
Render your knowledge graph to an interactive HTML file