mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 05:51:52 +09:00
[Refactor] 리팩터링
This commit is contained in:
parent
65150b3514
commit
e93e64756c
6 changed files with 32 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from lib.agents.get_sso_list import get_sso_list
|
||||
# 버전 업데이트 대비
|
||||
# 업데이트될 버전 import 아직 개발 중
|
||||
from lib.agents.get_sso_list_v2 import get_sso_list as get_sso_list_v2
|
||||
from lib.agents.login_google import login_google
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ Instructions:
|
|||
- Immediately stop and return the appropriate status.
|
||||
7. If login proceeds without interruptions, wait for redirection back to the original site and record the final URL.
|
||||
|
||||
Credentials to use (only if needed):
|
||||
Credentials to use for Google login:
|
||||
- Email: {GOOGLE_ID}
|
||||
- Password: {GOOGLE_PASSWORD}
|
||||
|
||||
Constraints:
|
||||
- Do NOT use search engines or guess URLs — only navigate links discoverable from https://example.com
|
||||
- Do NOT use search engines or guess URLs.
|
||||
- Do NOT use autofill, saved sessions, or cookies.
|
||||
- Do NOT proceed with login if:
|
||||
- The login opens in a new window (only tabs are allowed)
|
||||
|
|
@ -46,7 +46,7 @@ Constraints:
|
|||
- If the user is already logged in to Google and redirected back automatically, stop there and report success.
|
||||
- If the login page cannot be found, return "login_page_not_found".
|
||||
- If the Google login button is not found, return "sso_not_found".
|
||||
- If a page such as a sign-up page appears after entering the ID and password, consider it a successful login and terminate immediately.
|
||||
- If a page such as a sign-up page appears, consider it a successful login and terminate immediately.
|
||||
|
||||
Final Output:
|
||||
Return the result in the following format only:
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ from lib.utils.is_html import is_html_url
|
|||
from lib.utils.logger import logger
|
||||
from lib.utils.notify_backend import notify_backend
|
||||
from lib.utils.progress_checker import save_progress, load_progress
|
||||
# v2 import => 아직 개발 중
|
||||
from lib.utils.progress_checker_v2 import ProgressChecker
|
||||
from lib.utils.read_txt import read_lines_between
|
||||
from lib.utils.save_oauth_providers import save_oauth_providers
|
||||
|
||||
|
|
|
|||
|
|
@ -4,27 +4,6 @@ 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
|
||||
|
||||
|
||||
def save_progress(current_progress):
|
||||
"""현재 진행 상황을 파일에 저장"""
|
||||
with open(progress_file, 'w', encoding='utf-8') as f:
|
||||
|
|
|
|||
25
lib/utils/progress_checker_v2.py
Normal file
25
lib/utils/progress_checker_v2.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
2
main.py
2
main.py
|
|
@ -106,7 +106,7 @@ async def loop(
|
|||
current_progress["current_index"] = actual_index
|
||||
|
||||
print(f"\n🔄 Processing {actual_index + 1}/{current_progress['total']}: {url}")
|
||||
print(f"📍 domains.txt의 {start_line + actual_index}번째 줄")
|
||||
print(f"📍 domains.txt의 {actual_index}번째 줄")
|
||||
|
||||
await scan_one_url(url, skip_html_check=skip_html_check)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue