diff --git a/tool_core.js b/tool_core.js index 41cca3b..19aa4dc 100644 --- a/tool_core.js +++ b/tool_core.js @@ -343,12 +343,16 @@ module.exports = { }, // 20250621 todo 如果 text 是 {enUS,zhCN} 怎么处理 - extract_story_title (story) { + extract_story_title ({ story, lang = 'enUS' } = {}) { if (Array.isArray(story) && story.length) { return ( story - .map(({ text = '' } = {}) => text.trim?.()?.replace?.(/\n/g, ' ')) + .map(({ text = '' } = {}) => { + if (typeof text === 'string') return text.trim?.()?.replace?.(/\n/g, ' ') + else if (typeof text === 'object') return text[lang]?.trim?.()?.replace?.(/\n/g, ' ') + }) ?.join(' ') + ?.trim?.() ?.substring?.(0, 140) || '' ) } else {