Remove cruft

This commit is contained in:
2025-04-12 12:54:58 -05:00
parent a7fccf728c
commit 90dc188dc8

View File

@@ -14,14 +14,13 @@ app = FastAPI()
logger = Logger()
db = Database()
domain_exclusions = DomainExclusions() # Initialize with default config path
domain_exclusions = DomainExclusions()
@app.websocket("/ws")
async def websocket_endpoint(websocket: WebSocket):
await websocket.accept()
logger.info("New WebSocket connection established")
# Create crawler instance outside the loop for reuse
async with AsyncWebCrawler() as crawler:
try:
while True:
@@ -42,10 +41,8 @@ async def websocket_endpoint(websocket: WebSocket):
})
continue
# Crawl the URL to get title and content
try:
result = await crawler.arun(url=url)
# Get the first result from the container and access metadata
crawl_result = result[0]
title = crawl_result.metadata.get('title') or url.split("/")[-1]
content = crawl_result.markdown
@@ -54,7 +51,6 @@ async def websocket_endpoint(websocket: WebSocket):
title = url.split("/")[-1]
content = str(data)
# Store received data with crawled information
db.add_history(
url=url,
title=title,