yoitao-jimeng-sessionid
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJimeng SessionId
Jimeng SessionId
获取并返回即梦站点的 Cookie(只返回值,不写文件)。
sessionidObtain and return the Cookie of the Jimeng site (only returns the value, does not write to a file).
sessionid依赖项
Dependencies
本技能依赖 Playwright MCP,需要运行环境中已注册 Playwright MCP 服务,并可调用以下浏览器工具:
browser_navigate- (或同类页面状态读取工具)
browser_snapshot browser_run_codebrowser_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- (or similar page status reading tool)
browser_snapshot browser_run_codebrowser_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 (via ), so that the Jimeng login state can be persisted and you don't need to log in again every time.
profile--user-data-dirChoose 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 has expired and needs to be re-captured
sessionid
工作流
Workflow
1) 打开即梦页面
1) Open Jimeng Page
导航到:
text
https://jimeng.jianying.com/ai-tool/homeNavigate to:
text
https://jimeng.jianying.com/ai-tool/home2) 检查登录状态
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 名是小写 ,不是 。
sessionidsessionIdExecute 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 , not .
sessionidsessionId4) 返回结果并清理
4) Return Result and Clean Up
- 获取成功:直接返回 值
sessionid - 获取失败:返回“未找到 sessionid,建议刷新后重试”
- 最后关闭浏览器资源
- If obtained successfully: Directly return the value
sessionid - If failed to obtain: Return "sessionid not found, it is recommended to refresh and try again"
- Finally, close the browser resources
关键参数
Key Parameters
| 项目 | 值 |
|---|---|
| 目标站点 | |
| Cookie 名 | |
| 域名匹配 | |
| Item | Value |
|---|---|
| Target Site | |
| Cookie Name | |
| Domain Match | |
注意事项
Notes
- 会过期,需要按需刷新。
sessionid - 登录完成后如仍取不到 Cookie,先刷新页面再重试。
- will expire and needs to be refreshed as needed.
sessionid - If the Cookie still cannot be obtained after logging in, refresh the page first and try again.