feat(gateway): 扫码登录默认打开 douyin.com/user/self 个人中心页
未登录访问会引导登录,登录后浏览器停留在账号个人中心(用户指定页面,替代原首页)
This commit is contained in:
@@ -38,6 +38,8 @@ from ..runtime import ALIAS_RE
|
||||
LOG = logging.getLogger("creatorhub.douyin")
|
||||
ORIGIN = "https://www.douyin.com"
|
||||
ORIGIN_URL = ORIGIN + "/"
|
||||
# 扫码登录默认打开个人中心页:未登录访问会引导登录,登录后即停在账号个人中心。
|
||||
LOGIN_PAGE_URL = ORIGIN + "/user/self"
|
||||
LOGIN_ORIGINS = frozenset(
|
||||
{ORIGIN, "https://sso.douyin.com", "https://verify.snssdk.com", "https://verify.bytedance.com"}
|
||||
)
|
||||
@@ -379,7 +381,7 @@ class DouyinBrowser:
|
||||
|
||||
def login_qr(self, alias: str) -> BrowserLoginQRResponse:
|
||||
with self.connection(alias) as cdp:
|
||||
navigation = cdp.command("Page.navigate", {"url": ORIGIN_URL})
|
||||
navigation = cdp.command("Page.navigate", {"url": LOGIN_PAGE_URL})
|
||||
if (
|
||||
not isinstance(navigation, dict)
|
||||
or not isinstance(navigation.get("frameId"), str)
|
||||
|
||||
@@ -22,6 +22,7 @@ from .platform.douyin import (
|
||||
DouyinBrowser,
|
||||
DouyinError,
|
||||
DouyinSubscription,
|
||||
LOGIN_PAGE_URL,
|
||||
ORIGIN_URL,
|
||||
SubscriptionManager,
|
||||
ack_expression,
|
||||
@@ -848,6 +849,10 @@ class BrowserTests(unittest.TestCase):
|
||||
"Page.captureScreenshot",
|
||||
],
|
||||
)
|
||||
self.assertEqual(
|
||||
cdp.command.call_args_list[0].args,
|
||||
("Page.navigate", {"url": LOGIN_PAGE_URL}),
|
||||
)
|
||||
self.assertFalse(any("cookie" in expression.lower() for expression in cdp.evaluate.call_args.args))
|
||||
|
||||
def test_connect_selects_configured_target_from_large_mixed_list(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user