style(docs): improve code formatting in features demo

Clean up whitespace and improve readability in v0_4_3b2_features_demo.py:
- Remove excessive blank lines between functions
- Improve config formatting for better readability
- Uncomment memory dispatcher demo in main function

No breaking changes.
This commit is contained in:
UncleCode
2025-01-23 22:36:58 +08:00
parent 6a01008a2b
commit 65d33bcc0f

View File

@@ -95,7 +95,6 @@ async def demo_memory_dispatcher():
except Exception as e:
print(f"\n❌ Error in memory dispatcher demo: {str(e)}")
async def demo_streaming_support():
"""
2. Streaming Support Demo
@@ -127,7 +126,6 @@ async def demo_streaming_support():
if result.success:
print(f"Content length: {len(result.markdown)}")
async def demo_content_scraping():
"""
3. Content Scraping Strategy Demo
@@ -140,7 +138,10 @@ async def demo_content_scraping():
url = "https://example.com/article"
# Configure with the new LXML strategy
config = CrawlerRunConfig(scraping_strategy=LXMLWebScrapingStrategy(), verbose=True)
config = CrawlerRunConfig(
scraping_strategy=LXMLWebScrapingStrategy(),
verbose=True
)
print("Scraping content with LXML strategy...")
async with crawler:
@@ -148,9 +149,6 @@ async def demo_content_scraping():
if result.success:
print("Successfully scraped content using LXML strategy")
async def demo_llm_markdown():
"""
4. LLM-Powered Markdown Generation Demo
@@ -201,7 +199,6 @@ async def demo_llm_markdown():
print(result.markdown_v2.fit_markdown[:500])
print("Successfully generated LLM-filtered markdown")
async def demo_robots_compliance():
"""
5. Robots.txt Compliance Demo
@@ -225,8 +222,6 @@ async def demo_robots_compliance():
elif result.success:
print(f"Successfully crawled: {result.url}")
async def demo_json_schema_generation():
"""
7. LLM-Powered Schema Generation Demo
@@ -280,7 +275,6 @@ async def demo_json_schema_generation():
print(json.dumps(result.extracted_content, indent=2) if result.extracted_content else None)
print("Successfully used generated schema for crawling")
async def demo_proxy_rotation():
"""
8. Proxy Rotation Demo
@@ -340,7 +334,7 @@ async def main():
# Efficiency & Speed Demos
print("\n🚀 EFFICIENCY & SPEED DEMOS")
# await demo_memory_dispatcher()
await demo_memory_dispatcher()
await demo_streaming_support()
await demo_content_scraping()