Refactor: Move adeep_crawl as method of crawler itself. Create attributes in CrawlResult to reconstruct the tree once deep crawling is completed
This commit is contained in:
@@ -16,7 +16,6 @@ from .models import (
|
||||
MarkdownGenerationResult,
|
||||
CrawlerTaskResult,
|
||||
DispatchResult,
|
||||
DeepCrawlingProgress,
|
||||
)
|
||||
from .async_database import async_db_manager
|
||||
from .chunking_strategy import * # noqa: F403
|
||||
|
||||
@@ -135,6 +135,7 @@ async def advanced_scraper_example():
|
||||
|
||||
try:
|
||||
# Use streaming mode
|
||||
results = []
|
||||
result_generator = await crawler.adeep_crawl(
|
||||
"https://techcrunch.com",
|
||||
strategy=bfs_strategy,
|
||||
@@ -151,6 +152,7 @@ async def advanced_scraper_example():
|
||||
logger.info(
|
||||
f"Processed at depth: {result.depth} with score: {result.score:.3f} : \n {result.url}"
|
||||
)
|
||||
results.append(result)
|
||||
else:
|
||||
stats["errors"] += 1
|
||||
logger.error(
|
||||
|
||||
Reference in New Issue
Block a user