yoitao-jimeng-sessionid

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Jimeng SessionId

Jimeng SessionId

获取并返回即梦站点的
sessionid
Cookie(只返回值,不写文件)。
Obtain and return the
sessionid
Cookie of the Jimeng site (only returns the value, does not write to a file).

依赖项

Dependencies

本技能依赖 Playwright MCP,需要运行环境中已注册 Playwright MCP 服务,并可调用以下浏览器工具:
  • browser_navigate
  • browser_snapshot
    (或同类页面状态读取工具)
  • browser_run_code
  • browser_close
如果缺少以上能力,本技能无法完成登录检查与 Cookie 提取流程。
This skill depends on Playwright MCP. The runtime environment must have the Playwright MCP service registered, and the following browser tools must be callable:
  • browser_navigate
  • browser_snapshot
    (or similar page status reading tool)
  • browser_run_code
  • browser_close
If the above capabilities are missing, this skill cannot complete the login check and Cookie extraction process.

Playwright MCP 安装示例

Playwright MCP Installation Example

建议显式指定
profile
(通过
--user-data-dir
),这样即梦登录态可以持久化,不用每次重新登录。
以下为常见安装方式(按你的客户端选择其一):
It is recommended to explicitly specify a
profile
(via
--user-data-dir
), so that the Jimeng login state can be persisted and you don't need to log in again every time.
Choose one of the following common installation methods according to your client:

Claude Code

Claude Code

bash
claude mcp add playwright npx @playwright/mcp@latest -- --user-data-dir "$HOME/.yoitao/mcp/playwright-jimeng-profile"
bash
claude mcp add playwright npx @playwright/mcp@latest -- --user-data-dir "$HOME/.yoitao/mcp/playwright-jimeng-profile"

Codex

Codex

bash
codex mcp add playwright npx @playwright/mcp@latest -- --user-data-dir "$HOME/.yoitao/mcp/playwright-jimeng-profile"
安装后建议重启客户端,再执行本技能。
bash
codex mcp add playwright npx @playwright/mcp@latest -- --user-data-dir "$HOME/.yoitao/mcp/playwright-jimeng-profile"
After installation, it is recommended to restart the client before executing this skill.

触发场景

Trigger Scenarios

  • 用户要求获取即梦
    sessionid
  • 其他技能(如图片生成 skill)需要即梦认证凭据
  • 已有
    sessionid
    过期,需要重新抓取
  • The user requests to obtain Jimeng's
    sessionid
  • Other skills (such as image generation skills) require Jimeng authentication credentials
  • The existing
    sessionid
    has expired and needs to be re-captured

工作流

Workflow

1) 打开即梦页面

1) Open Jimeng Page

导航到:
text
https://jimeng.jianying.com/ai-tool/home
Navigate to:
text
https://jimeng.jianying.com/ai-tool/home

2) 检查登录状态

2) Check Login Status

  • 若页面出现“登录”按钮:提示用户先完成登录,并保持浏览器窗口不关闭
  • 若页面出现会员信息(如“基础会员”“高级会员”):继续下一步
  • If a "Login" button appears on the page: Prompt the user to complete login first and keep the browser window open
  • If member information (such as "Basic Member" or "Premium Member") appears on the page: Proceed to the next step

3) 读取 Cookie

3) Read Cookie

执行脚本读取 Cookie:
javascript
async (page) => {
  const cookies = await page.context().cookies();
  const sessionCookie = cookies.find(
    (c) =>
      c.name === "sessionid" &&
      (c.domain.includes("jimeng.jianying.com") || c.domain.includes("jianying.com")),
  );
  return sessionCookie ? sessionCookie.value : null;
}
注意:Cookie 名是小写
sessionid
,不是
sessionId
Execute the script to read the Cookie:
javascript
async (page) => {
  const cookies = await page.context().cookies();
  const sessionCookie = cookies.find(
    (c) =>
      c.name === "sessionid" &&
      (c.domain.includes("jimeng.jianying.com") || c.domain.includes("jianying.com")),
  );
  return sessionCookie ? sessionCookie.value : null;
}
Note: The Cookie name is lowercase
sessionid
, not
sessionId
.

4) 返回结果并清理

4) Return Result and Clean Up

  • 获取成功:直接返回
    sessionid
  • 获取失败:返回“未找到 sessionid,建议刷新后重试”
  • 最后关闭浏览器资源
  • If obtained successfully: Directly return the
    sessionid
    value
  • If failed to obtain: Return "sessionid not found, it is recommended to refresh and try again"
  • Finally, close the browser resources

关键参数

Key Parameters

项目
目标站点
https://jimeng.jianying.com/ai-tool/home
Cookie 名
sessionid
(小写)
域名匹配
jimeng.jianying.com
/
jianying.com
ItemValue
Target Site
https://jimeng.jianying.com/ai-tool/home
Cookie Name
sessionid
(lowercase)
Domain Match
jimeng.jianying.com
/
jianying.com

注意事项

Notes

  1. sessionid
    会过期,需要按需刷新。
  2. 登录完成后如仍取不到 Cookie,先刷新页面再重试。
  1. sessionid
    will expire and needs to be refreshed as needed.
  2. If the Cookie still cannot be obtained after logging in, refresh the page first and try again.