repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/arun_vs_arun_many.py
docs/examples/arun_vs_arun_many.py
import asyncio import time from crawl4ai.async_webcrawler import AsyncWebCrawler, CacheMode from crawl4ai.async_configs import CrawlerRunConfig from crawl4ai.async_dispatcher import MemoryAdaptiveDispatcher, RateLimiter VERBOSE = False async def crawl_sequential(urls): config = CrawlerRunConfig(cache_mode=CacheMo...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/stealth_mode_example.py
docs/examples/stealth_mode_example.py
""" Stealth Mode Example with Crawl4AI This example demonstrates how to use the stealth mode feature to bypass basic bot detection. The stealth mode uses playwright-stealth to modify browser fingerprints and behaviors that are commonly used to detect automated browsers. Key features demonstrated: 1. Comparing crawlin...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/crawlai_vs_firecrawl.py
docs/examples/crawlai_vs_firecrawl.py
import os, time # append the path to the root of the project import sys import asyncio sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..")) from firecrawl import FirecrawlApp from crawl4ai import AsyncWebCrawler __data__ = os.path.join(os.path.dirname(__file__), "..", "..") + "/.data" async def com...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/hooks_example.py
docs/examples/hooks_example.py
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode from playwright.async_api import Page, BrowserContext async def main(): print("🔗 Hooks Example: Demonstrating different hook use cases") # Configure browser settings browser_config = BrowserConfig(headless=True) # Conf...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/crypto_analysis_example.py
docs/examples/crypto_analysis_example.py
""" Crawl4AI Crypto Trading Analysis Demo Author: Unclecode Date: 2024-03-15 This script demonstrates advanced crypto market analysis using: 1. Web scraping of real-time CoinMarketCap data 2. Smart table extraction with layout detection 3. Hedge fund-grade financial metrics 4. Interactive visualizations for trading si...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/language_support_example.py
docs/examples/language_support_example.py
import asyncio from crawl4ai import AsyncWebCrawler, AsyncPlaywrightCrawlerStrategy async def main(): # Example 1: Setting language when creating the crawler crawler1 = AsyncWebCrawler( crawler_strategy=AsyncPlaywrightCrawlerStrategy( headers={"Accept-Language": "fr-FR,fr;q=0.9,en-US;q=0.8...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/use_geo_location.py
docs/examples/use_geo_location.py
# use_geo_location.py """ Example: override locale, timezone, and geolocation using Crawl4ai patterns. This demo uses `AsyncWebCrawler.arun()` to fetch a page with browser context primed for specific locale, timezone, and GPS, and saves a screenshot for visual verification. """ import asyncio import base64 from pathl...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/amazon_product_extraction_using_use_javascript.py
docs/examples/amazon_product_extraction_using_use_javascript.py
""" This example demonstrates how to use JSON CSS extraction to scrape product information from Amazon search results. It shows how to extract structured data like product titles, prices, ratings, and other details using CSS selectors. """ from crawl4ai import AsyncWebCrawler, CacheMode from crawl4ai import JsonCssEx...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/undetectability/undetected_cloudflare_test.py
docs/examples/undetectability/undetected_cloudflare_test.py
""" Undetected Browser Test - Cloudflare Protected Site Tests the difference between regular and undetected modes on a Cloudflare-protected site """ import asyncio from crawl4ai import ( AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, UndetectedAdapter ) from crawl4ai.async_crawler_strategy import ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/undetectability/undetected_bot_test.py
docs/examples/undetectability/undetected_bot_test.py
""" Bot Detection Test - Compare Regular vs Undetected Tests browser fingerprinting differences at bot.sannysoft.com """ import asyncio from crawl4ai import ( AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, UndetectedAdapter, CrawlResult ) from crawl4ai.async_crawler_strategy import AsyncPlaywr...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/undetectability/undetected_basic_test.py
docs/examples/undetectability/undetected_basic_test.py
""" Basic Undetected Browser Test Simple example to test if undetected mode works """ import asyncio from crawl4ai import AsyncWebCrawler, BrowserConfig async def test_regular_mode(): """Test with regular browser""" print("Testing Regular Browser Mode...") browser_config = BrowserConfig( headless=...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/undetectability/undetected_vs_regular_comparison.py
docs/examples/undetectability/undetected_vs_regular_comparison.py
""" Undetected vs Regular Browser Comparison This example demonstrates the difference between regular and undetected browser modes when accessing sites with bot detection services. Based on tested anti-bot services: - Cloudflare - Kasada - Akamai - DataDome - Bet365 - And others """ import asyncio from crawl4ai impor...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/url_seeder/url_seeder_demo.py
docs/examples/url_seeder/url_seeder_demo.py
""" URL Seeder Demo - Interactive showcase of Crawl4AI's URL discovery capabilities This demo shows: 1. Basic URL discovery from sitemaps and Common Crawl 2. Cache management and forced refresh 3. Live URL validation and metadata extraction 4. BM25 relevance scoring for intelligent filtering 5. Integration with AsyncW...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/url_seeder/url_seeder_quick_demo.py
docs/examples/url_seeder/url_seeder_quick_demo.py
""" 🚀 URL Seeder + AsyncWebCrawler = Magic! Quick demo showing discovery → filter → crawl pipeline Note: Uses context manager for automatic cleanup of resources. """ import asyncio, os from crawl4ai import AsyncUrlSeeder, AsyncWebCrawler, SeedingConfig, CrawlerRunConfig, AsyncLogger, DefaultMarkdownGenerator from cr...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/url_seeder/bbc_sport_research_assistant.py
docs/examples/url_seeder/bbc_sport_research_assistant.py
""" BBC Sport Research Assistant Pipeline ===================================== This example demonstrates how URLSeeder helps create an efficient research pipeline: 1. Discover all available URLs without crawling 2. Filter and rank them based on relevance 3. Crawl only the most relevant content 4. Generate comprehensi...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/url_seeder/convert_tutorial_to_colab.py
docs/examples/url_seeder/convert_tutorial_to_colab.py
#!/usr/bin/env python3 """ Convert Crawl4AI URL Seeder tutorial markdown to Colab notebook format """ import json import re from pathlib import Path def parse_markdown_to_cells(markdown_content): """Parse markdown content and convert to notebook cells""" cells = [] # Split content by cell markers ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/docker/demo_docker_api.py
docs/examples/docker/demo_docker_api.py
import asyncio import httpx import json import os import time from typing import List, Dict, Any, AsyncGenerator, Optional import textwrap # ← new: for pretty code literals import urllib.parse # ← needed for URL-safe /llm calls from dotenv import load_dotenv from rich.console import Console from rich.syntax i...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
true
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/docker/demo_docker_polling.py
docs/examples/docker/demo_docker_polling.py
#!/usr/bin/env python3 """ demo_docker_polling.py Quick sanity-check for the asynchronous crawl job endpoints: • POST /crawl/job – enqueue work, get task_id • GET /crawl/job/{id} – poll status / fetch result The style matches demo_docker_api.py (console.rule banners, helper functions, coloured st...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/advanced_configuration.py
docs/examples/adaptive_crawling/advanced_configuration.py
""" Advanced Adaptive Crawling Configuration This example demonstrates all configuration options available for adaptive crawling, including threshold tuning, persistence, and custom parameters. """ import asyncio from pathlib import Path from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig async de...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/basic_usage.py
docs/examples/adaptive_crawling/basic_usage.py
""" Basic Adaptive Crawling Example This example demonstrates the simplest use case of adaptive crawling: finding information about a specific topic and knowing when to stop. """ import asyncio from crawl4ai import AsyncWebCrawler, AdaptiveCrawler async def main(): """Basic adaptive crawling example""" ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/embedding_strategy.py
docs/examples/adaptive_crawling/embedding_strategy.py
""" Embedding Strategy Example for Adaptive Crawling This example demonstrates how to use the embedding-based strategy for semantic understanding and intelligent crawling. """ import asyncio import os from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig async def main(): """Demonstrate embeddin...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/export_import_kb.py
docs/examples/adaptive_crawling/export_import_kb.py
""" Knowledge Base Export and Import This example demonstrates how to export crawled knowledge bases and import them for reuse, sharing, or analysis. """ import asyncio import json from pathlib import Path from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig async def build_knowledge_base(): ""...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/embedding_vs_statistical.py
docs/examples/adaptive_crawling/embedding_vs_statistical.py
""" Comparison: Embedding vs Statistical Strategy This example demonstrates the differences between statistical and embedding strategies for adaptive crawling, showing when to use each approach. """ import asyncio import time import os from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig async def ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/embedding_configuration.py
docs/examples/adaptive_crawling/embedding_configuration.py
""" Advanced Embedding Configuration Example This example demonstrates all configuration options available for the embedding strategy, including fine-tuning parameters for different use cases. """ import asyncio import os from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig async def test_configura...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/llm_config_example.py
docs/examples/adaptive_crawling/llm_config_example.py
import asyncio import os from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig, LLMConfig async def test_configuration(name: str, config: AdaptiveConfig, url: str, query: str): """Test a specific configuration""" print(f"\n{'='*60}") print(f"Configuration: {name}") print(f"{'='*60}") ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/adaptive_crawling/custom_strategies.py
docs/examples/adaptive_crawling/custom_strategies.py
""" Custom Adaptive Crawling Strategies This example demonstrates how to implement custom scoring strategies for domain-specific crawling needs. """ import asyncio import re from typing import List, Dict, Set from crawl4ai import AsyncWebCrawler, AdaptiveCrawler, AdaptiveConfig from crawl4ai.adaptive_crawler import C...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/c4a_script_hello_world_error.py
docs/examples/c4a_script/c4a_script_hello_world_error.py
""" C4A-Script Hello World - Error Example Shows how error handling works """ from crawl4ai.script.c4a_compile import compile # Define a script with an error (missing THEN) script = """ GO https://example.com WAIT `#content` 5 IF (EXISTS `.cookie-banner`) CLICK `.accept` CLICK `button.submit` """ # Compile the scrip...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/c4a_script_hello_world.py
docs/examples/c4a_script/c4a_script_hello_world.py
""" C4A-Script Hello World A concise example showing how to use the C4A-Script compiler """ from crawl4ai.script.c4a_compile import compile # Define your C4A-Script script = """ GO https://example.com WAIT `#content` 5 IF (EXISTS `.cookie-banner`) THEN CLICK `.accept` CLICK `button.submit` """ # Compile the script r...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/api_usage_examples.py
docs/examples/c4a_script/api_usage_examples.py
""" C4A-Script API Usage Examples Shows how to use the new Result-based API in various scenarios """ from crawl4ai.script.c4a_compile import compile, validate, compile_file from crawl4ai.script.c4a_result import CompilationResult, ValidationResult import json print("C4A-Script API Usage Examples") print("=" * 80) #...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/generate_script_hello_world.py
docs/examples/c4a_script/generate_script_hello_world.py
#!/usr/bin/env python3 """ Hello World Example: LLM-Generated C4A-Script This example shows how to use the new generate_script() function to automatically create C4A-Script automation from natural language descriptions and HTML. """ from crawl4ai.script.c4a_compile import C4ACompiler def main(): print("🤖 C4A-Sc...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/demo_c4a_crawl4ai.py
docs/examples/c4a_script/demo_c4a_crawl4ai.py
""" Demonstration of C4A-Script integration with Crawl4AI Shows various use cases and features """ import asyncio from crawl4ai import AsyncWebCrawler, CrawlerRunConfig from crawl4ai import c4a_compile, CompilationResult async def example_basic_usage(): """Basic C4A-Script usage with Crawl4AI""" print("\n" + ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/amazon_example/amazon_r2d2_search.py
docs/examples/c4a_script/amazon_example/amazon_r2d2_search.py
#!/usr/bin/env python3 """ Amazon R2D2 Product Search Example using Crawl4AI This example demonstrates: 1. Using LLM to generate C4A-Script from HTML snippets 2. Multi-step crawling with session persistence 3. JSON CSS extraction for structured product data 4. Complete workflow: homepage → search → extract products R...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/tutorial/server.py
docs/examples/c4a_script/tutorial/server.py
#!/usr/bin/env python3 """ C4A-Script Tutorial Server Serves the tutorial app and provides C4A compilation API """ import sys import os from pathlib import Path from flask import Flask, render_template_string, request, jsonify, send_from_directory from flask_cors import CORS # Add parent directories to path to import...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/c4a_script/github_search/github_search_crawler.py
docs/examples/c4a_script/github_search/github_search_crawler.py
#!/usr/bin/env python3 """ GitHub Advanced Search Example using Crawl4AI This example demonstrates: 1. Using LLM to generate C4A-Script from HTML snippets 2. Single arun() call with navigation, search form filling, and extraction 3. JSON CSS extraction for structured repository data 4. Complete workflow: navigate → fi...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/nst_proxy/nstproxy_example.py
docs/examples/nst_proxy/nstproxy_example.py
""" NSTProxy Integration Examples for crawl4ai ------------------------------------------ NSTProxy is a premium residential proxy provider. 👉 Purchase Proxies: https://nstproxy.com 💰 Use coupon code "crawl4ai" for 10% off your plan. """ import asyncio from crawl4ai import AsyncWebCrawler, BrowserConfig async def ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/nst_proxy/auth_proxy_example.py
docs/examples/nst_proxy/auth_proxy_example.py
""" NSTProxy Integration Examples for crawl4ai ------------------------------------------ NSTProxy is a premium residential proxy provider. 👉 Purchase Proxies: https://nstproxy.com 💰 Use coupon code "crawl4ai" for 10% off your plan. """ import asyncio from crawl4ai import AsyncWebCrawler, BrowserConfig async def ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/nst_proxy/api_proxy_example.py
docs/examples/nst_proxy/api_proxy_example.py
""" NSTProxy Integration Examples for crawl4ai ------------------------------------------ NSTProxy is a premium residential proxy provider. 👉 Purchase Proxies: https://nstproxy.com 💰 Use coupon code "crawl4ai" for 10% off your plan. """ import asyncio, requests from crawl4ai import AsyncWebCrawler, BrowserConfig ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/nst_proxy/basic_proxy_example.py
docs/examples/nst_proxy/basic_proxy_example.py
""" NSTProxy Integration Examples for crawl4ai ------------------------------------------ NSTProxy is a premium residential proxy provider. 👉 Purchase Proxies: https://nstproxy.com 💰 Use coupon code "crawl4ai" for 10% off your plan. """ import asyncio from crawl4ai import AsyncWebCrawler, BrowserConfig async def ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/website-to-api/web_scraper_lib.py
docs/examples/website-to-api/web_scraper_lib.py
from crawl4ai import ( AsyncWebCrawler, BrowserConfig, CacheMode, CrawlerRunConfig, LLMConfig, JsonCssExtractionStrategy, LLMExtractionStrategy ) import os import json import hashlib from typing import Dict, Any, Optional, List from litellm import completion class ModelConfig: """Config...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/website-to-api/test_models.py
docs/examples/website-to-api/test_models.py
#!/usr/bin/env python3 """ Test script for the new model management functionality. This script demonstrates how to save and use custom model configurations. """ import asyncio import requests import json # API base URL BASE_URL = "http://localhost:8000" def test_model_management(): """Test the model management e...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/website-to-api/test_api.py
docs/examples/website-to-api/test_api.py
import asyncio from web_scraper_lib import scrape_website import os async def test_library(): """Test the mini library directly.""" print("=== Testing Mini Library ===") # Test 1: Scrape with a custom model url = "https://marketplace.mainstreet.co.in/collections/adidas-yeezy/products/adidas-yeezy-...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/website-to-api/api_server.py
docs/examples/website-to-api/api_server.py
from fastapi import FastAPI, HTTPException from fastapi.staticfiles import StaticFiles from fastapi.responses import FileResponse from pydantic import BaseModel, HttpUrl from typing import Dict, Any, Optional, Union, List import uvicorn import asyncio import os import json from datetime import datetime from web_scraper...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/website-to-api/app.py
docs/examples/website-to-api/app.py
#!/usr/bin/env python3 """ Startup script for the Web Scraper API with frontend interface. """ import os import sys import uvicorn from pathlib import Path def main(): # Check if static directory exists static_dir = Path("static") if not static_dir.exists(): print("❌ Static directory not found!") ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/cloud_browser/scrapeless_browser.py
docs/examples/cloud_browser/scrapeless_browser.py
import json import asyncio from urllib.parse import quote, urlencode from crawl4ai import CrawlerRunConfig, BrowserConfig, AsyncWebCrawler # Scrapeless provides a free anti-detection fingerprint browser client and cloud browsers: # https://www.scrapeless.com/en/blog/scrapeless-nstbrowser-strategic-integration async d...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/markdown/content_source_example.py
docs/examples/markdown/content_source_example.py
""" Example showing how to use the content_source parameter to control HTML input for markdown generation. """ import asyncio from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, DefaultMarkdownGenerator async def demo_content_source(): """Demonstrates different content_source options for markdown generation.""...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/markdown/content_source_short_example.py
docs/examples/markdown/content_source_short_example.py
""" Example demonstrating how to use the content_source parameter in MarkdownGenerationStrategy """ import asyncio from crawl4ai import AsyncWebCrawler, CrawlerRunConfig, DefaultMarkdownGenerator async def demo_markdown_source_config(): print("\n=== Demo: Configuring Markdown Source ===") # Example 1: Genera...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_cloudflare_challenge.py
docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_cloudflare_challenge.py
import time import asyncio from crawl4ai import * # TODO: the user data directory that includes the capsolver extension user_data_dir = "/browser-profile/Default1" """ The capsolver extension supports more features, such as: - Telling the extension when to start solving captcha. - Calling functions to check ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_aws_waf.py
docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_aws_waf.py
import time import asyncio from crawl4ai import * # TODO: the user data directory that includes the capsolver extension user_data_dir = "/browser-profile/Default1" """ The capsolver extension supports more features, such as: - Telling the extension when to start solving captcha. - Calling functions to check ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_recaptcha_v2.py
docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_recaptcha_v2.py
import time import asyncio from crawl4ai import * # TODO: the user data directory that includes the capsolver extension user_data_dir = "/browser-profile/Default1" """ The capsolver extension supports more features, such as: - Telling the extension when to start solving captcha. - Calling functions to check ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_recaptcha_v3.py
docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_recaptcha_v3.py
import time import asyncio from crawl4ai import * # TODO: the user data directory that includes the capsolver extension user_data_dir = "/browser-profile/Default1" """ The capsolver extension supports more features, such as: - Telling the extension when to start solving captcha. - Calling functions to check ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_cloudflare_turnstile.py
docs/examples/capsolver_captcha_solver/capsolver_extension_integration/solve_cloudflare_turnstile.py
import time import asyncio from crawl4ai import * # TODO: the user data directory that includes the capsolver extension user_data_dir = "/browser-profile/Default1" """ The capsolver extension supports more features, such as: - Telling the extension when to start solving captcha. - Calling functions to check ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_cloudflare_challenge.py
docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_cloudflare_challenge.py
import asyncio import capsolver from crawl4ai import * # TODO: set your config # Docs: https://docs.capsolver.com/guide/captcha/cloudflare_challenge/ api_key = "CAP-xxxxxxxxxxxxxxxxxxxxx" # your api key of capsolver site_url = "https://gitlab.com/users/sign_in" # page url of your target site captcha_type = ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_aws_waf.py
docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_aws_waf.py
import asyncio import capsolver from crawl4ai import * # TODO: set your config # Docs: https://docs.capsolver.com/guide/captcha/awsWaf/ api_key = "CAP-xxxxxxxxxxxxxxxxxxxxx" # your api key of capsolver site_url = "https://nft.porsche.com/onboarding@6" # page url of your target site cookie_domain = ".nft...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_recaptcha_v2.py
docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_recaptcha_v2.py
import asyncio import capsolver from crawl4ai import * # TODO: set your config # Docs: https://docs.capsolver.com/guide/captcha/ReCaptchaV2/ api_key = "CAP-xxxxxxxxxxxxxxxxxxxxx" # your api key of capsolver site_key = "6LfW6wATAAAAAHLqO2pb8bDBahxlMxNdo9g947u9" ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_recaptcha_v3.py
docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_recaptcha_v3.py
import asyncio import capsolver from crawl4ai import * # TODO: set your config # Docs: https://docs.capsolver.com/guide/captcha/ReCaptchaV3/ api_key = "CAP-xxxxxxxxxxxxxxxxxxxxx" # your api key of capsolver site_key = "6LdKlZEpAAAAAAOQjzC2v_d36tWxCl6dWsozdSy9" ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_cloudflare_turnstile.py
docs/examples/capsolver_captcha_solver/capsolver_api_integration/solve_cloudflare_turnstile.py
import asyncio import capsolver from crawl4ai import * # TODO: set your config # Docs: https://docs.capsolver.com/guide/captcha/cloudflare_turnstile/ api_key = "CAP-xxxxxxxxxxxxxxxxxxxxx" # your api key of capsolver site_key = "0x4AAAAAAAGlwMzq_9z6S9Mh" # site key of your t...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/md_v2/marketplace/backend/dummy_data.py
docs/md_v2/marketplace/backend/dummy_data.py
import sqlite3 import json import random from datetime import datetime, timedelta from database import DatabaseManager def generate_slug(text): return text.lower().replace(' ', '-').replace('&', 'and') def generate_dummy_data(): db = DatabaseManager() conn = db.conn cursor = conn.cursor() # Clear...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/md_v2/marketplace/backend/database.py
docs/md_v2/marketplace/backend/database.py
import sqlite3 import yaml import json from pathlib import Path from typing import Dict, List, Any class DatabaseManager: def __init__(self, db_path=None, schema_path='schema.yaml'): self.schema = self._load_schema(schema_path) # Use provided path or fallback to schema default self.db_path ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/md_v2/marketplace/backend/config.py
docs/md_v2/marketplace/backend/config.py
""" Marketplace Configuration - Loads from .env file """ import os import sys import hashlib from pathlib import Path from dotenv import load_dotenv # Load .env file env_path = Path(__file__).parent / '.env' if not env_path.exists(): print("\n❌ ERROR: No .env file found!") print("Please copy .env.example to .e...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/md_v2/marketplace/backend/server.py
docs/md_v2/marketplace/backend/server.py
from fastapi import FastAPI, HTTPException, Query, Depends, Body, UploadFile, File, Form, APIRouter from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse from fastapi.staticfiles import StaticFiles from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials from typing ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/md_v2/apps/c4a-script/server.py
docs/md_v2/apps/c4a-script/server.py
#!/usr/bin/env python3 """ C4A-Script Tutorial Server Serves the tutorial app and provides C4A compilation API """ import sys import os from pathlib import Path from flask import Flask, render_template_string, request, jsonify, send_from_directory from flask_cors import CORS # Add parent directories to path to import...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/demo_v0.7.0.py
docs/releases_review/demo_v0.7.0.py
""" 🚀 Crawl4AI v0.7.0 Release Demo ================================ This demo showcases all major features introduced in v0.7.0 release. Major Features: 1. ✅ Adaptive Crawling - Intelligent crawling with confidence tracking 2. ✅ Virtual Scroll Support - Handle infinite scroll pages 3. ✅ Link Preview - Advanced link a...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/demo_v0.7.5.py
docs/releases_review/demo_v0.7.5.py
""" 🚀 Crawl4AI v0.7.5 Release Demo - Working Examples ================================================== This demo showcases key features introduced in v0.7.5 with real, executable examples. Featured Demos: 1. ✅ Docker Hooks System - Real API calls with custom hooks (string & function-based) 2. ✅ Enhanced LLM Integra...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/v0.3.74.overview.py
docs/releases_review/v0.3.74.overview.py
import os, sys # append the parent directory to the sys.path parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.append(parent_dir) parent_parent_dir = os.path.dirname(parent_dir) sys.path.append(parent_parent_dir) __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/v0_7_0_features_demo.py
docs/releases_review/v0_7_0_features_demo.py
""" 🚀 Crawl4AI v0.7.0 Feature Demo ================================ This file demonstrates the major features introduced in v0.7.0 with practical examples. """ import asyncio import json from pathlib import Path from crawl4ai import ( AsyncWebCrawler, CrawlerRunConfig, BrowserConfig, CacheMode, # ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/v0.7.5_docker_hooks_demo.py
docs/releases_review/v0.7.5_docker_hooks_demo.py
#!/usr/bin/env python3 """ 🚀 Crawl4AI v0.7.5 - Docker Hooks System Complete Demonstration ================================================================ This file demonstrates the NEW Docker Hooks System introduced in v0.7.5. The Docker Hooks System is a completely NEW feature that provides pipeline customization ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/demo_v0.7.8.py
docs/releases_review/demo_v0.7.8.py
#!/usr/bin/env python3 """ Crawl4AI v0.7.8 Release Demo - Verification Tests ================================================== This demo ACTUALLY RUNS and VERIFIES the bug fixes in v0.7.8. Each test executes real code and validates the fix is working. Bug Fixes Verified: 1. ProxyConfig JSON serialization (#1629) 2. ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
true
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/v0_4_24_walkthrough.py
docs/releases_review/v0_4_24_walkthrough.py
""" Crawl4AI v0.4.24 Feature Walkthrough =================================== This script demonstrates the new features introduced in Crawl4AI v0.4.24. Each section includes detailed examples and explanations of the new capabilities. """ import asyncio import os import json import re from typing import List from crawl...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/demo_v0.7.6.py
docs/releases_review/demo_v0.7.6.py
#!/usr/bin/env python3 """ Crawl4AI v0.7.6 Release Demo ============================ This demo showcases the major feature in v0.7.6: **Webhook Support for Docker Job Queue API** Features Demonstrated: 1. Asynchronous job processing with webhook notifications 2. Webhook support for /crawl/job endpoint 3. Webhook supp...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/crawl4ai_v0_7_0_showcase.py
docs/releases_review/crawl4ai_v0_7_0_showcase.py
""" 🚀 Crawl4AI v0.7.0 Feature Showcase ===================================== This demo showcases the major features introduced in v0.7.0: 1. Link Preview/Peek - Advanced link analysis with 3-layer scoring 2. Adaptive Crawling - Intelligent crawling with confidence tracking 3. Virtual Scroll - Capture content from mode...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
true
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/demo_v0.7.7.py
docs/releases_review/demo_v0.7.7.py
#!/usr/bin/env python3 """ Crawl4AI v0.7.7 Release Demo ============================ This demo showcases the major feature in v0.7.7: **Self-Hosting with Real-time Monitoring Dashboard** Features Demonstrated: 1. System health monitoring with live metrics 2. Real-time request tracking (active & completed) 3. Browser ...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
unclecode/crawl4ai
https://github.com/unclecode/crawl4ai/blob/c85f56b085a1d5b62779774d48887345e566869b/docs/releases_review/v0_4_3b2_features_demo.py
docs/releases_review/v0_4_3b2_features_demo.py
""" Crawl4ai v0.4.3b2 Features Demo ============================ This demonstration showcases three major categories of new features in Crawl4ai v0.4.3: 1. Efficiency & Speed: - Memory-efficient dispatcher strategies - New scraping algorithm - Streaming support for batch crawling 2. LLM Integration: - Au...
python
Apache-2.0
c85f56b085a1d5b62779774d48887345e566869b
2026-01-04T14:38:51.943025Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/setup.py
setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from setuptools import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read() requirements = [ 'face_recognition_models>=0.3.0', 'Click>=6.0', 'dlib>=19.7', ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/tests/test_face_recognition.py
tests/test_face_recognition.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_face_recognition ---------------------------------- Tests for `face_recognition` module. """ import unittest import os import numpy as np from click.testing import CliRunner from face_recognition import api from face_recognition import face_recognition_cli fro...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/tests/__init__.py
tests/__init__.py
# -*- coding: utf-8 -*-
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/face_recognition/face_recognition_cli.py
face_recognition/face_recognition_cli.py
# -*- coding: utf-8 -*- from __future__ import print_function import click import os import re import face_recognition.api as face_recognition import multiprocessing import itertools import sys import PIL.Image import numpy as np def scan_known_people(known_people_folder): known_names = [] known_face_encoding...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/face_recognition/api.py
face_recognition/api.py
# -*- coding: utf-8 -*- import PIL.Image import dlib import numpy as np from PIL import ImageFile try: import face_recognition_models except Exception: print("Please install `face_recognition_models` with this command before using `face_recognition`:\n") print("pip install git+https://github.com/ageitgey/...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/face_recognition/face_detection_cli.py
face_recognition/face_detection_cli.py
# -*- coding: utf-8 -*- from __future__ import print_function import click import os import re import face_recognition.api as face_recognition import multiprocessing import sys import itertools def print_result(filename, location): top, right, bottom, left = location print("{},{},{},{},{}".format(filename, to...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/face_recognition/__init__.py
face_recognition/__init__.py
# -*- coding: utf-8 -*- __author__ = """Adam Geitgey""" __email__ = 'ageitgey@gmail.com' __version__ = '1.4.0' from .api import load_image_file, face_locations, batch_face_locations, face_landmarks, face_encodings, compare_faces, face_distance
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/docs/conf.py
docs/conf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # face_recognition documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in t...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/find_faces_in_picture_cnn.py
examples/find_faces_in_picture_cnn.py
from PIL import Image import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("biden.jpg") # Find all the faces in the image using a pre-trained convolutional neural network. # This method is more accurate than the default HOG model, but it's slower # unless you have an...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/blur_faces_on_webcam.py
examples/blur_faces_on_webcam.py
import face_recognition import cv2 # This is a demo of blurring faces in video. # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam. # OpenCV is *not* required to use the face_recognition library. It's only required if you want to run this # specific demo. If ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/web_service_example_Simplified_Chinese.py
examples/web_service_example_Simplified_Chinese.py
# 这是一个非常简单的使用Web服务上传图片运行人脸识别的案例,后端服务器会识别这张图片是不是奥巴马,并把识别结果以json键值对输出 # 比如:运行以下代码 # $ curl -XPOST -F "file=@obama2.jpg" http://127.0.0.1:5001 # 会返回: # { # "face_found_in_image": true, # "is_picture_of_obama": true # } # # 本项目基于Flask框架的案例 http://flask.pocoo.org/docs/0.12/patterns/fileuploads/ # 提示:运行本案例需要安装Flask,你可以用下面...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/web_service_example.py
examples/web_service_example.py
# This is a _very simple_ example of a web service that recognizes faces in uploaded images. # Upload an image file and it will check if the image contains a picture of Barack Obama. # The result is returned as json. For example: # # $ curl -XPOST -F "file=@obama2.jpg" http://127.0.0.1:5001 # # Returns: # # { # "face_...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/find_faces_in_batches.py
examples/find_faces_in_batches.py
import face_recognition import cv2 # This code finds all faces in a list of images using the CNN model. # # This demo is for the _special case_ when you need to find faces in LOTS of images very quickly and all the images # are the exact same size. This is common in video processing applications where you have lots of...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/recognize_faces_in_pictures.py
examples/recognize_faces_in_pictures.py
import face_recognition # Load the jpg files into numpy arrays biden_image = face_recognition.load_image_file("biden.jpg") obama_image = face_recognition.load_image_file("obama.jpg") unknown_image = face_recognition.load_image_file("obama2.jpg") # Get the face encodings for each face in each image file # Since there ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/find_faces_in_picture.py
examples/find_faces_in_picture.py
from PIL import Image import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("biden.jpg") # Find all the faces in the image using the default HOG-based model. # This method is fairly accurate, but not as accurate as the CNN model and not GPU accelerated. # See also: fi...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/facerec_on_raspberry_pi.py
examples/facerec_on_raspberry_pi.py
# This is a demo of running face recognition on a Raspberry Pi. # This program will print out the names of anyone it recognizes to the console. # To run this, you need a Raspberry Pi 2 (or greater) with face_recognition and # the picamera[array] module installed. # You can follow this installation instructions to get ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/face_distance.py
examples/face_distance.py
import face_recognition # Often instead of just checking if two faces match or not (True or False), it's helpful to see how similar they are. # You can do that by using the face_distance function. # The model was trained in a way that faces with a distance of 0.6 or less should be a match. But if you want to # be mor...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/facerec_from_webcam_multiprocessing.py
examples/facerec_from_webcam_multiprocessing.py
import face_recognition import cv2 from multiprocessing import Process, Manager, cpu_count, set_start_method import time import numpy import threading import platform # This is a little bit complicated (but fast) example of running face recognition on live video from your webcam. # This example is using multiprocess....
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/face_recognition_knn.py
examples/face_recognition_knn.py
""" This is an example of using the k-nearest-neighbors (KNN) algorithm for face recognition. When should I use this example? This example is useful when you wish to recognize a large set of known people, and make a prediction for an unknown person in a feasible computation time. Algorithm Description: The knn classi...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/facerec_from_webcam.py
examples/facerec_from_webcam.py
import face_recognition import cv2 import numpy as np # This is a super simple (but slow) example of running face recognition on live video from your webcam. # There's a second example that's a little more complicated but runs faster. # PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed onl...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/digital_makeup.py
examples/digital_makeup.py
from PIL import Image, ImageDraw import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("biden.jpg") # Find all facial features in all the faces in the image face_landmarks_list = face_recognition.face_landmarks(image) pil_image = Image.fromarray(image) for face_landm...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/benchmark.py
examples/benchmark.py
import timeit # Note: This example is only tested with Python 3 (not Python 2) # This is a very simple benchmark to give you an idea of how fast each step of face recognition will run on your system. # Notice that face detection gets very slow at large image sizes. So you might consider running face detection on a # ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/find_facial_features_in_picture.py
examples/find_facial_features_in_picture.py
from PIL import Image, ImageDraw import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("two_people.jpg") # Find all facial features in all the faces in the image face_landmarks_list = face_recognition.face_landmarks(image) print("I found {} face(s) in this photograph...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/facerec_on_raspberry_pi_Simplified_Chinese.py
examples/facerec_on_raspberry_pi_Simplified_Chinese.py
# 这是一个在树莓派上运行人脸识别的案例 # 本案例会在命令行控制面板上输出识别出的人脸数量和身份结果。 # 你需要一个2代以上的树莓派,并在树莓派上安装face_recognition,并连接上picamera摄像头 # 并确保picamera这个模块已经安装(树莓派一般会内置安装) # 你可以参考这个教程配制你的树莓派: # https://gist.github.com/ageitgey/1ac8dbe8572f3f533df6269dab35df65 import face_recognition import picamera import numpy as np # 你需要在sudo raspi-config中把c...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/facerec_from_webcam_faster.py
examples/facerec_from_webcam_faster.py
import face_recognition import cv2 import numpy as np # This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the # other example, but it includes some basic performance tweaks to make things run a lot faster: # 1. Process each video frame at 1/4 resolution (t...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/blink_detection.py
examples/blink_detection.py
#!/usr/bin/env python3 # This is a demo of detecting eye status from the users camera. If the users eyes are closed for EYES_CLOSED seconds, the system will start printing out "EYES CLOSED" # to the terminal until the user presses and holds the spacebar to acknowledge # this demo must be run with sudo privileges for...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/face_recognition_svm.py
examples/face_recognition_svm.py
# Train multiple images per person # Find and recognize faces in an image using a SVC with scikit-learn """ Structure: <test_image>.jpg <train_dir>/ <person_1>/ <person_1_face-1>.jpg <person_1_face-2>.jpg . . <p...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false
ageitgey/face_recognition
https://github.com/ageitgey/face_recognition/blob/2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1/examples/identify_and_draw_boxes_on_faces.py
examples/identify_and_draw_boxes_on_faces.py
import face_recognition from PIL import Image, ImageDraw import numpy as np # This is an example of running face recognition on a single image # and drawing a box around each person that was identified. # Load a sample picture and learn how to recognize it. obama_image = face_recognition.load_image_file("obama.jpg") ...
python
MIT
2e2dccea9dd0ce730c8d464d0f67c6eebb40c9d1
2026-01-04T14:39:09.099486Z
false