| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- """Try A1 login directly — see if 996box needs geetest or not this time."""
- import asyncio
- import sys
- from pathlib import Path
- _HERE = Path(__file__).resolve().parent
- sys.path.insert(0, str(_HERE.parent / "src"))
- from cq2_sdk.env_loader import load_env
- load_env(_HERE.parent / ".env")
- from cq2_sdk.login import Box996Login, CaptchaRequiredError, ManualGeetestSolver
- from cq2_sdk.store import UserStore, connection
- ACCOUNT = "longwu988"
- PASSWORD = "Longwu1988"
- DEVICE_ID = "00:15:5d:0a:04:00"
- async def main() -> int:
- box = Box996Login(geetest=ManualGeetestSolver(), device_id=DEVICE_ID)
- try:
- print("trying login_with_password (no captcha)...")
- session = await box.login_with_password(ACCOUNT, PASSWORD)
- print(f"[OK] no geetest needed! got session:")
- print(f" uid = {session.uid}")
- print(f" token = {session.token[:30]}...")
- # Save to MySQL
- with connection() as conn:
- u = UserStore(conn).upsert_by_username(ACCOUNT, session.token)
- print(f"[OK] saved to MySQL users table, id={u.id}")
- return 0
- except CaptchaRequiredError as e:
- print(f"[BLOCKED] 996box requires geetest this time: {e}")
- print(" → can't proceed without your manual slide")
- return 1
- except Exception as e:
- print(f"[ERROR] {type(e).__name__}: {e}")
- return 2
- if __name__ == "__main__":
- sys.exit(asyncio.run(main()))
|