mirror of
https://github.com/Zetaphor/browser-recall.git
synced 2025-12-06 10:29:38 +00:00
Remove cruft
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user