mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-14 06:16:43 +09:00
[Update] new logic
This commit is contained in:
parent
95d56259e7
commit
92967ed353
38 changed files with 1516 additions and 5209 deletions
53
lib/find_sso_list.py
Normal file
53
lib/find_sso_list.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
import asyncio
|
||||
from browser_use import Agent, BrowserSession
|
||||
from patchright.async_api import async_playwright as async_patchright
|
||||
from lib.agents.find_login_page import find_login_page
|
||||
from lib.browser_use_utils.clean_resources import clean_session_resources
|
||||
from lib.browser_use_utils.get_profile import get_profile
|
||||
|
||||
async def find_sso_list(target_url):
|
||||
session = BrowserSession(
|
||||
playwright=(await async_patchright().start()),
|
||||
browser_profile=await get_profile(),
|
||||
)
|
||||
|
||||
FIND_LOGIN_PAGE = 1
|
||||
FIND_SSO_LIST = 2
|
||||
SAVE_DATA = 3
|
||||
WHEN_ERROR = -1
|
||||
FINISH = 0
|
||||
|
||||
final_result = None
|
||||
task_queue = []
|
||||
|
||||
# find SSO
|
||||
state = FIND_LOGIN_PAGE
|
||||
while True:
|
||||
if state == FIND_LOGIN_PAGE:
|
||||
status, response = await find_login_page(
|
||||
target_url=target_url,
|
||||
session=session,
|
||||
)
|
||||
if not status:
|
||||
print(f"⚠️ 로그인 페이지 탐지 실패: {target_url} | {response}")
|
||||
state = WHEN_ERROR
|
||||
state = FIND_SSO_LIST
|
||||
|
||||
if state == FIND_SSO_LIST:
|
||||
print(f"🔎 SSO 목록 찾는 중: {target_url}")
|
||||
await asyncio.sleep(10) # 잠시 대기 후 다음 단계로 넘어감
|
||||
break
|
||||
|
||||
if state == SAVE_DATA:
|
||||
print(f"💾 데이터 저장 중: {target_url}")
|
||||
break
|
||||
|
||||
if state == WHEN_ERROR:
|
||||
print(f"⚠️ 에러 발생: {target_url} | 스캔을 중단합니다.")
|
||||
return
|
||||
|
||||
if state == FINISH:
|
||||
print(f"✅ 스캔 완료: {target_url}")
|
||||
break
|
||||
|
||||
await clean_session_resources(session)
|
||||
Loading…
Add table
Add a link
Reference in a new issue