部署与生态(3/3)

OPrompt for AI Coding Assistant: Create an Interactive LLM Context Builder Page

Objective:

Your task is to create an interactive HTML webpage with JavaScript functionality that allows users to select and combine different crawl4ai LLM context files into a single downloadable Markdown (.md) file. This tool will empower users to craft tailored context for their AI assistants based on their specific needs.

Core Functionality:

  1. Display crawl4ai Components: The page will list all available crawl4ai documentation components.
  2. Select Context Types: For each component, users can select which types of context they want to include:
    • Memory (API facts)
    • Reasoning (How-to/why)
    • Examples (Code snippets) (All should be selected by default for each initially selected component).
  3. Special "Aggregate" Contexts: Include options for special, pre-combined contexts:
    • "Vibe Coding" (a curated mix for general AI prompting)
    • "All Library Context" (a comprehensive aggregation of all memory, reasoning, and examples for the entire library).
  4. Fetch and Concatenate: When the user clicks a "Download Combined Context" button:
    • The JavaScript will fetch the content of all selected Markdown files from the server (from a predefined folder, e.g., /llmtxt/).
    • It will concatenate the content of these files into a single string.
  5. Client-Side Download: The concatenated content will be offered to the user as a download (e.g., custom_crawl4ai_context.md).

Input/Assumptions:

  • Context Files Location: All individual context Markdown files are located on the server in a publicly accessible folder named llmtxt/.
  • File Naming Convention: Files follow the pattern: crawl4ai_{{component_name}}_[memory|reasoning|examples]_content.llm.md.
    • {{component_name}} can contain underscores (e.g., deep_crawling, config_objects).
    • The special contexts will have names like crawl4ai_vibe_content.llm.md and crawl4ai_all_content.llm.md.
  • Component List: You will be provided with a list of crawl4ai components. For this implementation, use the following list:
    • core
    • config_objects
    • deep_crawling
    • deployment (covers Installation & Docker Deployment)
    • extraction (covers Structured Data Extraction)
    • markdown (covers Markdown Generation Algorithm)
    • pdf_processing
    • (No separate "Vibe Coding" or "All Library Context" in this list, as they are special top-level selections)

Detailed UI/UX Requirements:

  1. Main Page Structure:
    • Header: "Crawl4AI Interactive LLM Context Builder"
    • Introduction: Briefly explain the purpose of the tool (from the USING_LLM_CONTEXTS.md content you helped draft: "Supercharging Your AI Assistant...").
    • Selection Area:
      • Special Aggregate Contexts (Radio Buttons or Prominent Checkboxes):
        • [ ] "Vibe Coding Context" (crawl4ai_vibe_content.llm.md)
        • [ ] "All Library Context (Comprehensive)" (crawl4ai_all_content.llm.md)
        • Behavior: Selecting one of these might disable individual component selections (or vice-versa) to avoid redundancy, or simply add them to the list. Consider user experience here. A simple approach is that if an aggregate is selected, it's the only thing downloaded.
      • Individual Component Selection (Table or List of Checkboxes):
        • A section titled "Select Individual Components & Context Types:"
        • For each component in the provided list:
          • A master checkbox for the component itself (e.g., [ ] Core Functionality). Selected by default.
          • Nested checkboxes (indented or grouped) for context types, enabled only if the parent component is checked:
            • [x] Memory (API Facts)
            • [x] Reasoning (How-to/Why)
            • [x] Examples (Code Snippets) (These three sub-checkboxes should be selected by default if the parent component is selected).
    • Action Button:
      • A button: "Generate & Download Combined Context"
    • Status/Feedback Area: (Optional, but good UX)
      • Display messages like "Fetching files...", "Combining context...", "Download starting..." or error messages.

Final Output:

  • A single HTML file (e.g., interactive_context_builder.html).
  • Associated JavaScript code (can be inline within <script> tags or in a separate .js file).
  • Associated CSS code (can be inline within <style> tags or in a separate .css file).

This interactive tool will greatly enhance the user experience for crawl4ai developers looking to leverage your specialized LLM contexts. Please ensure the JavaScript is robust and provides good user feedback.


This prompt should give your AI coding assistant a very clear set of requirements and guidelines for building the interactive context builder. Remember to provide it with the list of components as mentioned in the "Input/Assumptions" section.


browser_manager.py

Function What it does
ManagedBrowser.build_browser_flags Returns baseline Chromium CLI flags, disables GPU and sandbox, plugs locale, timezone, stealth tweaks, and any extras from BrowserConfig.
ManagedBrowser.__init__ Stores config and logger, creates temp dir, preps internal state.
ManagedBrowser.start Spawns or connects to the Chromium process, returns its CDP endpoint plus the subprocess.Popen handle.
ManagedBrowser._initial_startup_check Pings the CDP endpoint once to be sure the browser is alive, raises if not.
ManagedBrowser._monitor_browser_process Async-loops on the subprocess, logs exits or crashes, restarts if policy allows.
ManagedBrowser._get_browser_path_WIP Old helper that maps OS + browser type to an executable path.
ManagedBrowser._get_browser_path Current helper, checks env vars, Playwright cache, and OS defaults for the real executable.
ManagedBrowser._get_browser_args Builds the final CLI arg list by merging user flags, stealth flags, and defaults.
ManagedBrowser.cleanup Terminates the browser, stops monitors, deletes the temp dir.
ManagedBrowser.create_profile Opens a visible browser so a human can log in, then zips the resulting user-data-dir to ~/.crawl4ai/profiles/<name>.
ManagedBrowser.list_profiles Thin wrapper, now forwarded to BrowserProfiler.list_profiles().
ManagedBrowser.delete_profile Thin wrapper, now forwarded to BrowserProfiler.delete_profile().
BrowserManager.__init__ Holds the global Playwright instance, browser handle, config signature cache, session map, and logger.
BrowserManager.start Boots the underlying ManagedBrowser, then spins up the default Playwright browser context with stealth patches.
BrowserManager._build_browser_args Translates CrawlerRunConfig (proxy, UA, timezone, headless flag, etc.) into Playwright launch_args.
BrowserManager.setup_context Applies locale, geolocation, permissions, cookies, and UA overrides on a fresh context.
BrowserManager.create_browser_context Internal helper that actually calls browser.new_context(**options) after running setup_context.
BrowserManager._make_config_signature Hashes the non-ephemeral parts of CrawlerRunConfig so contexts can be reused safely.
BrowserManager.get_page Returns a ready Page for a given session id, reusing an existing one or creating a new context/page, injects helper scripts, updates last_used.
BrowserManager.kill_session Force-closes a context/page for a session and removes it from the session map.
BrowserManager._cleanup_expired_sessions Periodic sweep that drops sessions idle longer than ttl_seconds.
BrowserManager.close Gracefully shuts down all contexts, the browser, Playwright, and background tasks.

browser_profiler.py

Function What it does
BrowserProfiler.__init__ Sets up profile folder paths, async logger, and signal handlers.
BrowserProfiler.create_profile Launches a visible browser with a new user-data-dir for manual login, on exit compresses and stores it as a named profile.
BrowserProfiler.cleanup_handler General SIGTERM/SIGINT cleanup wrapper that kills child processes.
BrowserProfiler.sigint_handler Handles Ctrl-C during an interactive session, makes sure the browser shuts down cleanly.
BrowserProfiler.listen_for_quit_command Async REPL that exits when the user types q.
BrowserProfiler.list_profiles Enumerates ~/.crawl4ai/profiles, prints profile name, browser type, size, and last modified.
BrowserProfiler.get_profile_path Returns the absolute path of a profile given its name, or None if missing.
BrowserProfiler.delete_profile Removes a profile folder or a direct path from disk, with optional confirmation prompt.
BrowserProfiler.interactive_manager Text UI loop for listing, creating, deleting, or launching profiles.
BrowserProfiler.launch_standalone_browser Starts a non-headless Chromium with remote debugging enabled and keeps it alive for manual tests.
BrowserProfiler.get_cdp_json Pulls /json/version from a CDP endpoint and returns the parsed JSON.
BrowserProfiler.launch_builtin_browser Spawns a headless Chromium in the background, saves {wsEndpoint, pid, started_at} to ~/.crawl4ai/builtin_browser.json.
BrowserProfiler.get_builtin_browser_info Reads that JSON file, verifies the PID, and returns browser status info.
BrowserProfiler._is_browser_running Cross-platform helper that checks if a PID is still alive.
BrowserProfiler.kill_builtin_browser Terminates the background builtin browser and removes its status file.
BrowserProfiler.get_builtin_browser_status Returns {running: bool, wsEndpoint, pid, started_at} for quick health checks.

Let me know what you want to tweak or dive into next.


When I started diving deep into using AI coding assistants with my own libraries, particularly crawl4ai, I quickly realized that the common approach to providing context via a simple llm.txt or even a beefed-up README.md just wasn't cutting it. This document explains the problems I encountered and how I've tried to create a more effective system for crawl4ai, allowing you (and your AI assistant) to get precisely the right information.

My Frustration with Standard llm.txt Files

My experience with generic llm.txt files for complex libraries like crawl4ai revealed several pain points:

  1. Information Overload & Lost Focus: I found that when I threw a massive, monolithic context file at an LLM, it often struggled. The sheer volume of information seemed to dilute its focus. If I asked a specific question about a niche feature, the LLM might get sidetracked by more prominent but currently irrelevant parts of the library. It felt like trying to find a single sentence in a thousand-page novel – the information was there, but not always accessible or prioritized correctly by the AI.

  2. The "What" Without the "How" or "Why": Most llm.txt files I encountered were essentially API dumps – a list of functions, classes, and parameters. This is the "what" of a library. But to truly use a library effectively, especially one as flexible as crawl4ai, you need the "how" (idiomatic usage patterns, best practices for common tasks) and the "why" (the design rationale behind certain features). Without this, I noticed my AI assistant would often generate syntactically correct but practically inefficient or non-idiomatic code. It was guessing the intent and the best way to use the library, and those guesses weren't always right.

  3. No Guidance on "Thinking" Like an Expert: A static list of facts doesn't teach an LLM the art of using the library. It doesn't convey the trade-offs an experienced developer considers, the common pitfalls they've learned to avoid, or the clever ways to combine features to solve complex problems. I wanted my AI assistant to not just recall an API, but to help me reason about the best way to build a solution with crawl4ai.

Inspiration: Selective Inclusion & Multi-Dimensional Understanding

I've always admired how libraries like Lodash or jQuery (in its modular days) allowed developers to pick and choose only the parts they needed, resulting in smaller, more focused bundles. This idea of modularity and selective inclusion resonated deeply with me as I thought about LLM context. Why force-feed an LLM the entire library's details when I'm only working on a specific component or task?

This led me to develop a new approach for crawl4ai: multi-dimensional, modular contexts.

Instead of one giant llm.txt, I've broken down the crawl4ai documentation into:

  1. Logical Components: Context is organized around the major functional areas of the library (e.g., Core, Data Extraction, Deep Crawling, Markdown Generation, etc.). This allows you to select context relevant only to the task at hand.
  2. Three Dimensions of Context for Each Component:
    • _memory.md (Foundational Memory): This is the "what." It contains the precise, factual information about the component's public API, data structures, configuration objects, parameters, and method signatures. It's the detailed, unambiguous reference.
    • _reasoning.md (Reasoning & Problem-Solving Framework): This is the "how" and "why." It includes design principles, common task workflows with decision guides, best practices, anti-patterns, illustrative code examples solving real problems, and explanations of trade-offs. It aims to guide the LLM in "thinking" like an expert crawl4ai user.
    • _examples.md (Practical Code Examples): This is pure "show-me-the-code." It's a collection of runnable snippets demonstrating various ways to use the component's features and configurations, with minimal explanatory text. It’s for quickly seeing different patterns in action.

The Goal: My aim is to provide you with a flexible system. You can give your AI assistant: * Just the memory files for quick API lookups. * The reasoning files (perhaps with memory) for help designing solutions. * The examples files for seeing practical implementations. * A combination of these across one or more components tailored to your specific task. * Or, for broader understanding, special aggregate contexts like the "Vibe Coding" context or the "All Library Context."

By providing these structured, multi-faceted contexts, I hope to significantly improve the quality and relevance of the assistance you get when using AI to code with crawl4ai. The following sections will guide you on how to select and use these different context files.


Instructions: Copy this content to create security advisories at: https://github.com/unclecode/crawl4ai/security/advisories/new


Advisory 1: Remote Code Execution via Hooks Parameter

Title

Remote Code Execution in Docker API via Hooks Parameter

Severity

Critical

CVSS Score

10.0 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H)

CWE

CWE-94 (Improper Control of Generation of Code)

Package

crawl4ai (Docker API deployment)

Affected Versions

< 0.8.0

Patched Versions

0.8.0

Description

A critical remote code execution vulnerability exists in the Crawl4AI Docker API deployment. The /crawl endpoint accepts a hooks parameter containing Python code that is executed using exec(). The __import__ builtin was included in the allowed builtins, allowing attackers to import arbitrary modules and execute system commands.

Attack Vector:

POST /crawl
{
  "urls": ["https://example.com"],
  "hooks": {
    "code": {
      "on_page_context_created": "async def hook(page, context, **kwargs):\n    __import__('os').system('malicious_command')\n    return page"
    }
  }
}

Impact

An unauthenticated attacker can: - Execute arbitrary system commands - Read/write files on the server - Exfiltrate sensitive data (environment variables, API keys) - Pivot to internal network services - Completely compromise the server

Mitigation

  1. Upgrade to v0.8.0 (recommended)
  2. If unable to upgrade immediately:
  3. Disable the Docker API
  4. Block /crawl endpoint at network level
  5. Add authentication to the API

Fix Details

  1. Removed __import__ from allowed_builtins in hook_manager.py
  2. Hooks disabled by default (CRAWL4AI_HOOKS_ENABLED=false)
  3. Users must explicitly opt-in to enable hooks

Credits

Discovered by Neo by ProjectDiscovery (https://projectdiscovery.io)

References


Advisory 2: Local File Inclusion via file:// URLs

Title

Local File Inclusion in Docker API via file:// URLs

Severity

High

CVSS Score

8.6 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N)

CWE

CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

Package

crawl4ai (Docker API deployment)

Affected Versions

< 0.8.0

Patched Versions

0.8.0

Description

A local file inclusion vulnerability exists in the Crawl4AI Docker API. The /execute_js, /screenshot, /pdf, and /html endpoints accept file:// URLs, allowing attackers to read arbitrary files from the server filesystem.

Attack Vector:

POST /execute_js
{
  "url": "file:///etc/passwd",
  "scripts": ["document.body.innerText"]
}

Impact

An unauthenticated attacker can: - Read sensitive files (/etc/passwd, /etc/shadow, application configs) - Access environment variables via /proc/self/environ - Discover internal application structure - Potentially read credentials and API keys

Mitigation

  1. Upgrade to v0.8.0 (recommended)
  2. If unable to upgrade immediately:
  3. Disable the Docker API
  4. Add authentication to the API
  5. Use network-level filtering

Fix Details

Added URL scheme validation to block: - file:// URLs - javascript: URLs - data: URLs - Other non-HTTP schemes

Only http://, https://, and raw: URLs are now allowed.

Credits

Discovered by Neo by ProjectDiscovery (https://projectdiscovery.io)

References


Creating the Advisories on GitHub

  1. Go to: https://github.com/unclecode/crawl4ai/security/advisories/new

  2. Fill in the form for each advisory:

  3. Ecosystem: PyPI
  4. Package name: crawl4ai
  5. Affected versions: < 0.8.0
  6. Patched versions: 0.8.0
  7. Severity: Critical (for RCE), High (for LFI)

  8. After creating, GitHub will:

  9. Assign a GHSA ID
  10. Optionally request a CVE
  11. Notify users who have security alerts enabled

  12. Coordinate disclosure timing with the fix release


Open In Colab

A three‑stage demo that goes from LinkedIn scraping ➜ LLM reasoning ➜ graph visualisation.

Try it in Google Colab! Click the badge above to run this demo in a cloud environment with zero setup required.

prospect‑wizard/
├─ c4ai_discover.py         # Stage 1 – scrape companies + people
├─ c4ai_insights.py         # Stage 2 – embeddings, org‑charts, scores
├─ graph_view_template.html # Stage 3 – graph viewer (static HTML)
└─ data/                    # output lands here (*.jsonl / *.json)

1  Install & boot a LinkedIn profile (one‑time)

1.1  Install dependencies

pip install crawl4ai litellm sentence-transformers pandas rich

1.2  Create / warm a LinkedIn browser profile

crwl profiles
  1. The interactive shell shows New profile – hit enter.
  2. Choose a name, e.g. profile_linkedin_uc.
  3. A Chromium window opens – log in to LinkedIn, solve whatever CAPTCHA, then close.

Remember the profile name. All future runs take --profile-name <your_name>.


2  Discovery – scrape companies & people

python c4ai_discover.py full \
  --query "health insurance management" \
  --geo 102713980 \               # Malaysia geoUrn
  --title-filters "" \            # or "Product,Engineering"
  --max-companies 10 \            # default set small for workshops
  --max-people 20 \               # \^ same
  --profile-name profile_linkedin_uc \
  --outdir ./data \
  --concurrency 2 \
  --log-level debug

Outputs in ./data/: * companies.jsonl – one JSON per company * people.jsonl – one JSON per employee

🛠️ Dry‑run: C4AI_DEMO_DEBUG=1 python c4ai_discover.py full --query coffee uses bundled HTML snippets, no network.

Handy geoUrn cheatsheet

Location geoUrn
Singapore 103644278
Malaysia 102713980
United States 103644922
United Kingdom 102221843
Australia 101452733
See more: <https://www.linkedin.com/search/results/companies/?geoUrn=XXX> – the number after geoUrn= is what you need.

3  Insights – embeddings, org‑charts, decision makers

python c4ai_insights.py \
  --in ./data \
  --out ./data \
  --embed-model all-MiniLM-L6-v2 \
  --llm-provider gemini/gemini-2.0-flash \
  --llm-api-key "" \
  --top-k 10 \
  --max-llm-tokens 8024 \
  --llm-temperature 1.0 \
  --workers 4

Emits next to the Stage‑1 files: * company_graph.json – inter‑company similarity graph * org_chart_<handle>.json – one per company * decision_makers.csv – hand‑picked ‘who to pitch’ list

Flags reference (straight from build_arg_parser()): | Flag | Default | Purpose | |------|---------|---------| | --in | . | Stage‑1 output dir | | --out | . | Destination dir | | --embed_model | all-MiniLM-L6-v2 | Sentence‑Transformer model | | --top_k | 10 | Neighbours per company in graph | | --openai_model | gpt-4.1 | LLM for scoring decision makers | | --max_llm_tokens | 8024 | Token budget per LLM call | | --llm_temperature | 1.0 | Creativity knob | | --stub | off | Skip OpenAI and fabricate tiny charts | | --workers | 4 | Parallel LLM workers |


4  Visualise – interactive graph

After Stage 2 completes, simply open the HTML viewer from the project root:

open graph_view_template.html   # or Live Server / Python -http

The page fetches data/company_graph.json and the org_chart_*.json files automatically; keep the data/ folder beside the HTML file.

  • Left pane → list of companies (clans).
  • Click a node to load its org‑chart on the right.
  • Chat drawer lets you ask follow‑up questions; context is pulled from people.jsonl.

5  Common snags

Symptom Fix
Infinite CAPTCHA Use a residential proxy: --proxy http://user:pass@ip:port
429 Too Many Requests Lower --concurrency, rotate profile, add delay
Blank graph Check JSON paths, clear localStorage in browser

TL;DR

crwl profiles → c4ai_discover.py → c4ai_insights.py → open graph_view_template.html. Live long and import crawl4ai.


cli.py command surface

Command Inputs / flags What it does
profiles (none) Opens the interactive profile manager, lets you list, create, delete saved browser profiles that live in ~/.crawl4ai/profiles.
browser status – Prints whether the always-on builtin browser is running, shows its CDP URL, PID, start time.
browser stop – Kills the builtin browser and deletes its status file.
browser view --url, -u URL (optional) Pops a visible window of the builtin browser, navigates to URL or about:blank.
config list – Dumps every global setting, showing current value, default, and description.
config get key Prints the value of a single setting, falls back to default if unset.
config set key value Persists a new value in the global config (stored under ~/.crawl4ai/config.yml).
examples – Just spits out real-world CLI usage samples.
crawl url (positional)<br>--browser-config,-B path<br>--crawler-config,-C path<br>--filter-config,-f path<br>--extraction-config,-e path<br>--json-extract,-j [desc]*<br>--schema,-s path<br>--browser,-b k=v list<br>--crawler,-c k=v list<br>--output,-o all,json,markdown,md,markdown-fit,md-fit (default all)<br>--output-file,-O path<br>--bypass-cache,-b (flag, default true — note flag reuse)<br>--question,-q str<br>--verbose,-v (flag)<br>--profile,-p profile-name One-shot crawl + extraction. Builds BrowserConfig and CrawlerRunConfig from inline flags or separate YAML/JSON files, runs AsyncWebCrawler.run(), can route through a named saved profile and pipe the result to stdout or a file.
(default) Same flags as crawl, plus --example Shortcut so you can type just crwl https://site.com. When first arg is not a known sub-command, it falls through to crawl.

* --json-extract/-j with no value turns on LLM-based JSON extraction using an auto schema, supplying a string lets you prompt-engineer the field descriptions.

Quick mental model profiles = manage identities, browser ... = control long-running headless Chrome that all crawls can piggy-back on, crawl = do the actual work, config = tweak global defaults, everything else is sugar.

Quick-fire “profile” usage cheatsheet

Scenario Command (copy-paste ready) Notes
Launch interactive Profile Manager UI crwl profiles Opens TUI with options: 1 List, 2 Create, 3 Delete, 4 Use-to-crawl, 5 Exit.
Create a fresh profile crwl profiles → choose 2 → name it → browser opens → log in → press q in terminal Saves to ~/.crawl4ai/profiles/<name>.
List saved profiles crwl profiles → choose 1 Shows name, browser type, size, last-modified.
Delete a profile crwl profiles → choose 3 → pick the profile index → confirm Removes the folder.
Crawl with a profile (default alias) crwl https://site.com/dashboard -p my-profile Keeps login cookies, sets use_managed_browser=true under the hood.
Crawl + verbose JSON output crwl https://site.com -p my-profile -o json -v Any other crawl flags work the same.
Crawl with extra browser tweaks crwl https://site.com -p my-profile -b "headless=true,viewport_width=1680" CLI overrides go on top of the profile.
Same but via explicit sub-command crwl crawl https://site.com -p my-profile Identical to default alias.
Use profile from inside Profile Manager crwl profiles → choose 4 → pick profile → enter URL → follow prompts Handy when demo-ing to non-CLI folks.
One-off crawl with a profile folder path (no name lookup) crwl https://site.com -b "user_data_dir=$HOME/.crawl4ai/profiles/my-profile,use_managed_browser=true" Bypasses registry, useful for CI scripts.
Launch a dev browser on CDP port with the same identity crwl cdp -d $HOME/.crawl4ai/profiles/my-profile -P 9223 Lets Puppeteer/Playwright attach for debugging.

Visual extraction tools for Crawl4AI - Click to extract data and content from any webpage!

🚀 Features

  • Click2Crawl: Click on elements to build data extraction schemas instantly
  • Markdown Extraction: Select elements and export as clean markdown
  • Script Builder (Alpha): Record browser actions to create automation scripts
  • Smart Element Selection: Container and field selection with visual feedback
  • Code Generation: Generates complete Python code for Crawl4AI
  • Beautiful Dark UI: Consistent with Crawl4AI's design language

📦 Installation

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable "Developer mode" in the top right corner
  3. Click "Load unpacked"
  4. Select the crawl4ai-assistant folder
  5. The extension icon (🚀🤖) will appear in your toolbar

Method 2: Generate Icons First

If you want proper icons:

  1. Open icons/generate_icons.html in your browser
  2. Right-click each canvas and save as:
  3. icon-16.png
  4. icon-48.png
  5. icon-128.png
  6. Then follow Method 1 above

🎯 How to Use

Using Click2Crawl

  1. Navigate to any website you want to extract data from
  2. Click the Crawl4AI extension icon in your toolbar
  3. Click "Click2Crawl" to start the capture mode
  4. Select a container element:
  5. Hover over elements (they'll highlight in blue)
  6. Click on a repeating container (e.g., product card, article block)
  7. Select fields within the container:
  8. Elements will now highlight in green
  9. Click on each piece of data you want to extract
  10. Name each field (e.g., "title", "price", "description")
  11. Test and Export:
  12. Click "Test Schema" to see extracted data instantly
  13. Export as Python code, JSON schema, or markdown

Running the Generated Code

The downloaded Python file contains:

# 1. The HTML snippet of your selected container
HTML_SNIPPET = """..."""

# 2. The extraction query based on your selections
EXTRACTION_QUERY = """..."""

# 3. Functions to generate and test the schema
async def generate_schema():
    # Generates the extraction schema using LLM

async def test_extraction():
    # Tests the schema on the actual website

To use it:

  1. Install Crawl4AI: pip install crawl4ai
  2. Run the script: python crawl4ai_schema_*.py
  3. The script will generate a generated_schema.json file
  4. Use this schema in your Crawl4AI projects!

🎨 Visual Feedback

  • Blue dashed outline: Container selection mode
  • Green dashed outline: Field selection mode
  • Solid blue outline: Selected container
  • Solid green outline: Selected fields
  • Floating toolbar: Shows current mode and selection status

⌨️ Keyboard Shortcuts

  • ESC: Cancel current capture session

🔧 Technical Details

  • Built with Manifest V3 for security and performance
  • Pure client-side - no data sent to external servers
  • Generates code that uses Crawl4AI's LLM integration
  • Smart selector generation prioritizes stable attributes

🐛 Troubleshooting

Extension doesn't load

  • Make sure you're in Developer Mode
  • Check the console for any errors
  • Ensure all files are in the correct directories

Can't select elements

  • Some websites may block extensions
  • Try refreshing the page
  • Make sure you clicked "Schema Builder" first

Generated code doesn't work

  • Ensure you have Crawl4AI installed
  • Check that you have an LLM API key configured
  • Make sure the website structure hasn't changed

🤝 Contributing

This extension is part of the Crawl4AI project. Contributions are welcome!

📄 License

Same as Crawl4AI - see main project for details.