mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 11:01:52 +09:00
feat: OAuth 리스트 추출 및 로그인 기능 개선
- README.md: uv 실행 명령어 수정 - lib/llm/prompt: OAuth 리스트 추출 및 fallback 프롬프트 추가 - lib/utils/browser_use: 프로필 생성 시 스토리지 상태 파일 처리 개선 - lib/utils/browser_use/func: 안전한 JSON 읽기 및 쓰기 함수 추가 - main.py: OAuth 리스트 추출 및 개별 로그인 시도 통합 - model.py: OAuth 모델 수정
This commit is contained in:
parent
4f90285bdd
commit
4b3637b762
8 changed files with 444 additions and 206 deletions
|
|
@ -1,11 +1,26 @@
|
|||
import os
|
||||
from lib.utils.browser_use.func import *
|
||||
|
||||
# Initialize configuration
|
||||
proxy_url = setup_proxy()
|
||||
|
||||
# Create browser profile
|
||||
async def GetProfile():
|
||||
storage_state_path = await setup_storage_state()
|
||||
|
||||
# Handle potential encoding issues with storage state file
|
||||
try:
|
||||
if storage_state_path and os.path.exists(storage_state_path):
|
||||
# Test if file can be read properly, if not, skip it
|
||||
with open(storage_state_path, 'r', encoding='utf-8') as f:
|
||||
f.read()
|
||||
storage_state = storage_state_path
|
||||
else:
|
||||
print("⚠️ Storage state file not found or inaccessible, proceeding without it.")
|
||||
storage_state = None
|
||||
except (UnicodeDecodeError, FileNotFoundError):
|
||||
# If there's an encoding error, don't use the storage state
|
||||
storage_state = None
|
||||
|
||||
profile = BrowserProfile(
|
||||
# Security settings
|
||||
disable_security=True,
|
||||
|
|
@ -19,7 +34,7 @@ async def GetProfile():
|
|||
|
||||
# Data persistence
|
||||
user_data_dir=None,
|
||||
storage_state=storage_state_path,
|
||||
storage_state=storage_state,
|
||||
|
||||
# Network settings
|
||||
proxy={"server": proxy_url} if proxy_url else None,
|
||||
|
|
@ -28,4 +43,4 @@ async def GetProfile():
|
|||
args=get_browser_args(),
|
||||
)
|
||||
|
||||
return profile
|
||||
return profile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue