mirror of
https://github.com/j93es/browser-use-oauth.git
synced 2026-06-04 05:31:51 +09:00
Chromium 설치 메시지 수정 및 사용자 데이터 복사 로직 개선
This commit is contained in:
parent
2b805df001
commit
68eedc3fa4
2 changed files with 12 additions and 9 deletions
13
setup.py
13
setup.py
|
|
@ -27,9 +27,10 @@ def create_file_from_example(target: str, example: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
def install_playwright_chrome():
|
def install_playwright_chrome():
|
||||||
print("\n🛠️ Playwright의 Chrome을 설치 중입니다...")
|
print("\n🛠️ Playwright의 Chromium을 설치 중입니다...")
|
||||||
|
print("👉 이 작업은 시간이 걸릴 수 있습니다. 잠시 기다려주세요.")
|
||||||
try:
|
try:
|
||||||
subprocess.run(['uv', 'run', 'playwright', 'install', 'chrome'], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
subprocess.run(['uv', 'run', 'playwright', 'install', 'chromium'], check=True)
|
||||||
print("✅ Playwright Chrome 설치 완료.")
|
print("✅ Playwright Chrome 설치 완료.")
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
if "already" in e.stdout.decode():
|
if "already" in e.stdout.decode():
|
||||||
|
|
@ -107,12 +108,13 @@ async def setup_user_data():
|
||||||
initial_actions=initial_actions,
|
initial_actions=initial_actions,
|
||||||
browser_profile=BrowserProfile(
|
browser_profile=BrowserProfile(
|
||||||
disable_security=True,
|
disable_security=True,
|
||||||
stealth=True,
|
#stealth=True,
|
||||||
headless=False,
|
headless=False,
|
||||||
device_scale_factor=1,
|
device_scale_factor=1,
|
||||||
window_size={"width": 1600, "height": 900},
|
window_size={"width": 1600, "height": 900},
|
||||||
viewport={"width": 1600, "height": 900},
|
viewport={"width": 1600, "height": 900},
|
||||||
user_data_dir="./data/user_data",
|
user_data_dir="./data/user_data",
|
||||||
|
ignore_default_args=['--enable-automation'],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -168,8 +170,8 @@ if __name__ == "__main__":
|
||||||
print("=====================================================")
|
print("=====================================================")
|
||||||
|
|
||||||
# 3. Windows 인코딩 문제 해결
|
# 3. Windows 인코딩 문제 해결
|
||||||
i_dont_like_windows()
|
#i_dont_like_windows()
|
||||||
print("=====================================================")
|
#print("=====================================================")
|
||||||
|
|
||||||
# 4. Setup User Data
|
# 4. Setup User Data
|
||||||
asyncio.run(setup_user_data())
|
asyncio.run(setup_user_data())
|
||||||
|
|
@ -179,4 +181,3 @@ if __name__ == "__main__":
|
||||||
# setup_sensitive()
|
# setup_sensitive()
|
||||||
print("=====================================================")
|
print("=====================================================")
|
||||||
print("🎉 초기 설정이 완료되었습니다! 이제 스크립트를 실행할 준비가 되었습니다.")
|
print("🎉 초기 설정이 완료되었습니다! 이제 스크립트를 실행할 준비가 되었습니다.")
|
||||||
print("🎉 초기 설정이 완료되었습니다! 이제 스크립트를 실행할 준비가 되었습니다.")
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@ async def GetProfile(headless=False):
|
||||||
if USER_DATA_DIR and os.path.isdir(USER_DATA_DIR):
|
if USER_DATA_DIR and os.path.isdir(USER_DATA_DIR):
|
||||||
try:
|
try:
|
||||||
tmp_user_data_dir = tempfile.mkdtemp()
|
tmp_user_data_dir = tempfile.mkdtemp()
|
||||||
shutil.copytree(USER_DATA_DIR, tmp_user_data_dir, dirs_exist_ok=True)
|
if os.path.exists(tmp_user_data_dir):
|
||||||
|
shutil.rmtree(tmp_user_data_dir)
|
||||||
|
shutil.copytree(USER_DATA_DIR, tmp_user_data_dir, dirs_exist_ok=False, ignore_dangling_symlinks=True)
|
||||||
user_data_dir = tmp_user_data_dir
|
user_data_dir = tmp_user_data_dir
|
||||||
print(f"✅ Copied user data dir to temporary location: {user_data_dir}")
|
print(f"✅ Copied user data dir to temporary location: {user_data_dir}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -23,12 +25,11 @@ async def GetProfile(headless=False):
|
||||||
profile = BrowserProfile(
|
profile = BrowserProfile(
|
||||||
# Security settings
|
# Security settings
|
||||||
disable_security=True,
|
disable_security=True,
|
||||||
stealth=True,
|
#stealth=True,
|
||||||
# Display settings
|
# Display settings
|
||||||
headless=headless,
|
headless=headless,
|
||||||
device_scale_factor=1,
|
device_scale_factor=1,
|
||||||
window_size={"width": 1600, "height": 900},
|
window_size={"width": 1600, "height": 900},
|
||||||
viewport={"width": 1600, "height": 900},
|
|
||||||
# Data persistence
|
# Data persistence
|
||||||
user_data_dir=user_data_dir,
|
user_data_dir=user_data_dir,
|
||||||
#storage_state=storage_state,
|
#storage_state=storage_state,
|
||||||
|
|
@ -36,6 +37,7 @@ async def GetProfile(headless=False):
|
||||||
proxy={"server": proxy_url} if proxy_url else None,
|
proxy={"server": proxy_url} if proxy_url else None,
|
||||||
# Additional arguments
|
# Additional arguments
|
||||||
args=get_browser_args(),
|
args=get_browser_args(),
|
||||||
|
ignore_default_args=['--enable-automation']
|
||||||
)
|
)
|
||||||
|
|
||||||
return profile
|
return profile
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue