在 2026 年第二季度的 creator-center 重构之后,`sau douyin login` 无法实现端到端连接

作者: DerekEXS创建于 2026年6月16日更新于 2026年6月16日

(1) QR selector no longer matches the page

Old selector chain (commit 90e01c0-ish):

python
scan_login_tab = page.get_by_text("扫码登录", exact=True).first
qrcode_img = (
    scan_login_tab
    .locator("..")
    .locator("xpath=following-sibling::div[1]")
    .locator('img[aria-label="二维码"]')
    .first
)

This worked when the login page rendered the QR inside a sibling <div> with aria-label="二维码". The current page is a single-tab layout (class single_tab-...); the QR lives inside div#animate_qrcode_container as a base64 PNG with no aria-label.

(2) _wait_for_douyin_login only waits for sessionid cookie

sessionid is set after the 2FA / SMS code step completes, not when the user scans. For accounts that trigger 2FA, the URL changes immediately on the phone's "confirm" tap, but the cookie does not appear for several seconds while the user is typing the SMS code. A 120s timeout is not enough; the loop also needs to recognise that the page is in a "verification in progress" state and not bail.

内容来源: dreammis/social-auto-upload