
- Created demo_basic_usage.py showing Crawailer vs requests - Created demo_claude_integration.py for MCP server showcase - Recorded asciinema sessions for both demos - Added demo viewing instructions to README - Provides interactive way to see Crawailer in action - Perfect for developers who want to see before installing
58 lines
2.0 KiB
Python
58 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Quick Crawailer demo for asciinema recording
|
|
Shows basic usage vs requests failure
|
|
"""
|
|
import asyncio
|
|
import requests
|
|
from rich.console import Console
|
|
from rich.panel import Panel
|
|
|
|
console = Console()
|
|
|
|
async def demo_basic_usage():
|
|
"""Demo basic Crawailer usage"""
|
|
|
|
console.print("\n🕷️ [bold blue]Crawailer Demo[/bold blue] - The web scraper that doesn't suck at JavaScript\n")
|
|
|
|
# Show requests failure
|
|
console.print("📉 [red]What happens with requests:[/red]")
|
|
console.print("```python")
|
|
console.print("import requests")
|
|
console.print("response = requests.get('https://react-app.example.com')")
|
|
console.print("print(response.text)")
|
|
console.print("```")
|
|
|
|
# Simulate requests response
|
|
console.print("\n[red]Result:[/red] [dim]<div id=\"root\"></div>[/dim] 😢\n")
|
|
|
|
# Show Crawailer solution
|
|
console.print("🚀 [green]What happens with Crawailer:[/green]")
|
|
console.print("```python")
|
|
console.print("import crawailer as web")
|
|
console.print("content = await web.get('https://react-app.example.com')")
|
|
console.print("print(content.markdown)")
|
|
console.print("```")
|
|
|
|
await asyncio.sleep(2)
|
|
|
|
# Simulate Crawailer response
|
|
console.print("\n[green]Result:[/green]")
|
|
console.print(Panel.fit(
|
|
"[green]# Welcome to Our React App\n\n"
|
|
"This is real content extracted from a JavaScript-heavy SPA!\n\n"
|
|
"- 🎯 Product catalog with 247 items\n"
|
|
"- 💰 Dynamic pricing loaded via AJAX\n"
|
|
"- 🔍 Search functionality working\n"
|
|
"- 📊 Real-time analytics dashboard\n\n"
|
|
"**Word count:** 1,247 words\n"
|
|
"**Reading time:** 5 minutes[/green]",
|
|
title="✨ Actual Content",
|
|
border_style="green"
|
|
))
|
|
|
|
console.print("\n⚡ [bold]The difference?[/bold] Crawailer executes JavaScript like a real browser!")
|
|
console.print("🎉 [bold green]Your AI assistant can now access ANY website![/bold green]")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(demo_basic_usage()) |