diff --git a/analyze.py b/analyze.py index bd5637f..70108e4 100644 --- a/analyze.py +++ b/analyze.py @@ -142,7 +142,8 @@ def analyze_file_content(filename: str): if images: ocr_result = pytesseract.image_to_string(images[0], lang='kor+eng') page_text += "\n" + ocr_result - except: pass + except Exception as ocr_err: + print(f"OCR Error on page {i+1}: {ocr_err}") text_by_pages.append(page_text) elif filename.lower().endswith(('.xlsx', '.xls')): import pandas as pd diff --git a/crawler_service.py b/crawler_service.py index f20ce38..30b4384 100644 --- a/crawler_service.py +++ b/crawler_service.py @@ -21,19 +21,20 @@ async def run_crawler_service(): results = [] async with async_playwright() as p: - yield f"data: {json.dumps({'type': 'log', 'message': '브라우저 실행 중...'})}\n\n" - browser = await p.chromium.launch(headless=True, args=[ - "--no-sandbox", - "--disable-dev-shm-usage", - "--disable-blink-features=AutomationControlled" - ]) - context = await browser.new_context( - viewport={'width': 1920, 'height': 1080}, - user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" - ) - page = await context.new_page() - + browser = None try: + yield f"data: {json.dumps({'type': 'log', 'message': '브라우저 실행 중...'})}\n\n" + browser = await p.chromium.launch(headless=True, args=[ + "--no-sandbox", + "--disable-dev-shm-usage", + "--disable-blink-features=AutomationControlled" + ]) + context = await browser.new_context( + viewport={'width': 1920, 'height': 1080}, + user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" + ) + page = await context.new_page() + yield f"data: {json.dumps({'type': 'log', 'message': '사이트 접속 및 로그인 중...'})}\n\n" await page.goto("https://overseas.projectmastercloud.com/", wait_until="domcontentloaded") @@ -131,7 +132,10 @@ async def run_crawler_service(): yield f"data: {json.dumps({'type': 'done', 'data': results})}\n\n" + except GeneratorExit: + # SSE 연결이 클라이언트 측에서 먼저 끊겼을 때 실행 + if browser: await browser.close() except Exception as e: yield f"data: {json.dumps({'type': 'log', 'message': f'치명적 오류: {str(e)}'})}\n\n" finally: - await browser.close() + if browser: await browser.close() diff --git a/dashboard.html b/dashboard.html deleted file mode 100644 index 59e224b..0000000 --- a/dashboard.html +++ /dev/null @@ -1,360 +0,0 @@ - - - - - - - Project Master Overseas 관리자 - - - - - - - - -
-
-
-

프로젝트 현황

-
-
- -
접속자: 이태훈[전체관리자]
-
-
- - - - -
- -
-
- - - - - \ No newline at end of file diff --git a/debug_modal.html b/debug_modal.html index 8e345ea..31b4811 100644 --- a/debug_modal.html +++ b/debug_modal.html @@ -1,6 +1,6 @@
-
+
로그필터 @@ -10,11 +10,11 @@ 활동시간
시작 - +
종료 - +
@@ -35,64 +35,64 @@
파일 / 폴더관련 유저관련 기타 @@ -114,46 +114,15 @@ -
-
-