fix: 优化时区问题
This commit is contained in:
parent
c69f9c8e47
commit
e1fe82a3a5
@ -19,6 +19,8 @@ argument-hint: "无需参数,直接调用即可"
|
||||
1. 使用 `web-page` 这个网页内容读取、自动化交互和截图技能,访问 `https://quote.eastmoney.com/stockhotmap/` 这个网页。
|
||||
2. 网页上有这个类名(`topzs`)的 div 元素,展示了`上证指数`、`深证成指`、`创业板指`、`科创综指`、`北证50`的涨跌情况。你需要这些信息的时候,就从这个元素里提取出来。
|
||||
3. 网页上有这个类名(`stockmap`)的 div 元素,展示了各个板块的涨跌情况。你需要这些信息的时候,就从这个元素里提取出来。
|
||||
4. 这个网页是 ajax 动态渲染的,访问后等待 5 秒钟再提取内容。
|
||||
5. 如果需要截图,截图前先将带有这个类名(`em_widget em_show`)的元素删除
|
||||
|
||||
## 回复要求
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ const DEFAULT_TIMEOUT_MS = 45000;
|
||||
const DEFAULT_MAX_CHARS = 16000;
|
||||
const DEFAULT_ACTION_TIMEOUT_MS = 15000;
|
||||
const DEFAULT_ACTION_WAIT_MS = 300;
|
||||
const DEFAULT_TIMEZONE = "Asia/Shanghai";
|
||||
|
||||
const ACTION_TYPES = new Set<string>([
|
||||
"click",
|
||||
@ -303,7 +304,9 @@ function normalizeAction(
|
||||
throw new Error(`第 ${index + 1} 个 press action 必须提供 key`);
|
||||
}
|
||||
if (type === "remove" && !action.selector && !action.text) {
|
||||
throw new Error(`第 ${index + 1} 个 remove action 必须提供 selector 或 text`);
|
||||
throw new Error(
|
||||
`第 ${index + 1} 个 remove action 必须提供 selector 或 text`,
|
||||
);
|
||||
}
|
||||
if (type === "wait_for_selector" && !action.selector) {
|
||||
throw new Error("wait_for_selector action 必须提供 selector");
|
||||
@ -814,6 +817,14 @@ async function createPage(client: CdpClient, params: Params): Promise<string> {
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
await client.send(
|
||||
"Emulation.setTimezoneOverride",
|
||||
{
|
||||
timezoneId:
|
||||
process.env.WEB_PAGE_TIMEZONE || process.env.TZ || DEFAULT_TIMEZONE,
|
||||
},
|
||||
sessionId,
|
||||
);
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user