mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 04:41:53 +09:00
25 lines
762 B
Python
25 lines
762 B
Python
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
progress_file = Path("data/scan_progress.json")
|
|
|
|
class ProgressChecker:
|
|
def __init__(self, filepath):
|
|
self.filepath = filepath
|
|
self.progress = self.load_progress()
|
|
|
|
def save(self):
|
|
"""현재 진행 상황을 파일에 저장"""
|
|
with open(self.filepath, 'w', encoding='utf-8') as f:
|
|
json.dump(self.progress, f, ensure_ascii=False, indent=2)
|
|
|
|
def load(self):
|
|
"""이전 진행 상황을 파일에서 불러오기"""
|
|
if os.path.exists(self.filepath):
|
|
try:
|
|
with open(self.filepath, 'r', encoding='utf-8') as f:
|
|
return json.load(f)
|
|
except:
|
|
return None
|
|
return None
|