工作流文件
n8n-落地页AI体检-国内版.json
{"name":"落地页 AI 体检(国内版)","nodes":[{"parameters":{"content":"## 落地页 AI 体检(国内版)\n派派编辑部改自 n8n 官方模板库 #3100。\n\n**第一次用:**\n1. 双击「模型」→ Credential to connect with → Create new credential,填 DeepSeek 的 API Key,Model 选 deepseek-flash\n2. 点右上角 Publish 发布\n3. 双击「填网址」,复制 Production URL,在登录了 n8n 的浏览器里打开;第一次会问能不能用你的 n8n 账号运行,点 Allow access\n\n**谁能用:** 表单默认只给登录了这个 n8n 的人用(「填网址」→ Authentication = n8n User Auth)。别改成 None 再把网址发出去:填网址的人能让 n8n 去访问任意地址,「检查网址」只挡住了常见的内网写法。\n\n**只适合普通网页:** 要登录的页面、淘宝 / 京东 / 拼多多商品页、靠 JavaScript 才显示内容的页面抓不到正文,会提示「抓到的是空壳」。\n\nAI 的打分和建议只作参考;改出来的文案对外发布前,按《广告法》再核一遍。","height":640,"width":520,"color":4},"id":"eff42af3-cbde-5dbb-9a25-32a2724583ed","name":"说明","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-860,-200]},{"parameters":{"formTitle":"落地页 AI 体检","formDescription":"填上你的官网、活动页、独立站或公众号文章的网址,AI 读完整页文字,给每一项打分,并写出 10 条能直接改的建议。大约 1 分钟出结果。","formFields":{"values":[{"fieldLabel":"网页地址","fieldName":"url","placeholder":"https://","requiredField":true},{"fieldLabel":"这个页面想让访客做什么(选填)","fieldName":"goal","placeholder":"例如:加微信咨询、留电话预约到店、直接下单"},{"fieldLabel":"主要给谁看(选填)","fieldName":"audience","placeholder":"例如:杭州 25~40 岁、想买茶送礼的上班族"}]},"authentication":"n8nUserAuth","responseMode":"lastNode","options":{"appendAttribution":false,"buttonLabel":"开始体检"}},"id":"3e683d20-9c2b-5d70-9670-f78212addba0","name":"填网址","type":"n8n-nodes-base.formTrigger","typeVersion":2.6,"position":[-160,160]},{"parameters":{"mode":"runOnceForEachItem","jsCode":"// 整理网址;挡掉内网地址(不然填表的人能让 n8n 去访问你内网里的服务)\nconst ALLOW_PRIVATE = false;\nlet url = String($json.url || '').trim();\nif (url && !/^https?:\\/\\//i.test(url)) url = 'https://' + url;\nlet problem = '';\nlet host = '';\n// Code 节点里没有 URL 对象,用正则取域名\nconst m = url.match(/^https?:\\/\\/(?:[^\\/?#@]*@)?(\\[[^\\]]+\\]|[^\\/?#:]+)/i);\nif (m && /[a-z0-9]/i.test(m[1])) host = m[1].toLowerCase(); else problem = '网址格式不对,请复制浏览器地址栏里的完整网址,例如 https://www.example.com/';\nif (!problem && !ALLOW_PRIVATE && (/^(localhost|0\\.0\\.0\\.0|\\[?::1\\]?)$/.test(host) || /^(127|10)\\./.test(host) || /^192\\.168\\./.test(host) || /^172\\.(1[6-9]|2\\d|3[01])\\./.test(host) || /^169\\.254\\./.test(host) || host.endsWith('.local') || host.endsWith('.internal'))) {\n problem = '为了安全,不体检内网地址(localhost、192.168.x.x 这类)。';\n}\nreturn { json: { url, goal: String($json.goal || '').trim(), audience: String($json.audience || '').trim(), problem } };"},"id":"d4861937-c6d0-5958-9187-b05efccb2344","name":"检查网址","type":"n8n-nodes-base.code","typeVersion":2,"position":[60,160]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"loose","version":2},"conditions":[{"id":"c1","leftValue":"={{ $json.problem }}","rightValue":"","operator":{"type":"string","operation":"empty","singleValue":true}}],"combinator":"and"},"options":{}},"id":"4f7fc37d-5027-5219-9459-aa586f68b587","name":"网址能用吗","type":"n8n-nodes-base.if","typeVersion":2.2,"position":[280,160]},{"parameters":{"url":"={{ $json.url }}","sendHeaders":true,"headerParameters":{"parameters":[{"name":"User-Agent","value":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0 Safari/537.36"},{"name":"Accept-Language","value":"zh-CN,zh;q=0.9,en;q=0.6"}]},"options":{"timeout":20000,"redirect":{"redirect":{"maxRedirects":5}},"response":{"response":{"fullResponse":true,"neverError":true,"responseFormat":"text"}}}},"id":"460f9ecb-8c72-5bef-82ec-e2436bb0b20e","name":"抓网页","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[500,60],"onError":"continueRegularOutput"},{"parameters":{"mode":"runOnceForEachItem","jsCode":"// 去掉脚本、样式、图标这些模型用不上的代码,顺便数一下图片、表单、按钮\nconst r = $json;\nconst page = $('检查网址').item.json;\nconst fail = (msg) => ({ json: { ...page, problem: msg, html: '' } });\nif (r.error) {\n const m = String(r.error.message || r.error.description || JSON.stringify(r.error));\n return fail(/ENOTFOUND|EAI_AGAIN/.test(m) ? '域名解析失败,检查网址有没有拼错。'\n : /timeout|ETIMEDOUT|ECONNABORTED/i.test(m) ? '网页 20 秒没打开,可能是网站太慢,或者跑 n8n 的机器访问不到它。'\n : /ECONNREFUSED/.test(m) ? '网站拒绝连接,检查网址和端口。'\n : /certificate|CERT_|SSL/i.test(m) ? '网站的 HTTPS 证书有问题。' : '网页打不开:' + m.slice(0, 120));\n}\nconst code = Number(r.statusCode || 200);\nif (code >= 400) return fail(`网站返回 ${code},可能是页面不存在、要登录,或者网站把 n8n 当成了机器人。`);\nconst ctype = String((r.headers || {})['content-type'] || '');\nif (ctype && !/html|xml|text\\/plain/i.test(ctype)) return fail(`这个地址不是网页(${ctype.split(';')[0]})。`);\nlet html = String(r.data || '');\nconst pick = (re) => { const m = html.match(re); return m ? m[1].replace(/\\s+/g, ' ').trim() : ''; };\nconst og = (k) => pick(new RegExp('<meta[^>]+property=[\"\\']og:' + k + '[\"\\'][^>]+content=[\"\\']([^\"\\']*)[\"\\']', 'i'));\nconst title = pick(/<title[^>]*>([\\s\\S]*?)<\\/title>/i) || og('title');\nconst description = pick(/<meta[^>]+name=[\"']description[\"'][^>]+content=[\"']([^\"']*)[\"']/i)\n || pick(/<meta[^>]+content=[\"']([^\"']*)[\"'][^>]+name=[\"']description[\"']/i) || og('description');\nconst imgs = html.match(/<img\\b[^>]*>/gi) || [];\nconst noAlt = imgs.filter(t => !/\\balt\\s*=\\s*[\"'][^\"']+[\"']/i.test(t)).length;\nconst stats = {\n html_kb: Math.round(html.length / 1024),\n images: imgs.length, images_without_alt: noAlt,\n forms: (html.match(/<form\\b/gi) || []).length,\n form_fields: (html.match(/<(input|select|textarea)\\b(?![^>]*type=[\"']?(hidden|submit)\\b)/gi) || []).length,\n buttons: (html.match(/<button\\b/gi) || []).length,\n has_viewport: /<meta[^>]+name=[\"']viewport[\"']/i.test(html),\n};\nhtml = html.replace(/<!--[\\s\\S]*?-->/g, '')\n .replace(/<(script|style|noscript|svg|iframe|template|canvas)\\b[\\s\\S]*?<\\/\\1>/gi, '')\n .replace(/<(link|meta)\\b[^>]*>/gi, '')\n .replace(/\\s(style|class|id|data-[\\w-]+|on\\w+)=(\"[^\"]*\"|'[^']*')/gi, '');\nreturn { json: { ...page, problem: '', title, description, stats, html } };"},"id":"7d0b886d-2116-545e-91b4-33339a41f924","name":"整理网页","type":"n8n-nodes-base.code","typeVersion":2,"position":[720,60]},{"parameters":{"html":"={{ $json.html }}","destinationKey":"page_text","options":{}},"id":"e6af5615-825a-50d9-b468-11d164c00eb9","name":"转成文字","type":"n8n-nodes-base.markdown","typeVersion":1,"position":[940,60]},{"parameters":{"mode":"runOnceForEachItem","jsCode":"// 前端渲染的页面(比如很多 App 官网、小程序 H5)抓下来只有一个空壳,正文几乎是 0\nconst MAX_CHARS = 15000; // 太长的页面只看前 15000 个字,防止一次花太多钱\nconst MIN_CHARS = 150; // 少于 150 个字就当作空壳,不调模型\nif ($json.problem) return { json: $json };\nlet text = String($json.page_text || '')\n .replace(/!\\[\\]\\([^)]*\\)/g, '[图片,没写替代文字]')\n .replace(/\\]\\((data:[^)]{0,40})[^)]*\\)/g, ']($1…)')\n .replace(/\\n{3,}/g, '\\n\\n').trim();\nconst plain = text.replace(/!?\\[([^\\]]*)\\]\\([^)]*\\)/g, '$1').replace(/[#>*_`|\\-\\s]/g, '');\nif (plain.length < MIN_CHARS) {\n return { json: { ...$json, problem: `抓到的是空壳:网页源代码里只有 ${plain.length} 个字,正文应该是打开后才用 JavaScript 加载的。淘宝、京东、拼多多的商品页和不少 App 官网都是这样,n8n 直接抓不到。可以在浏览器里全选复制页面文字,发给 DeepSeek 用本工作流里的提示词问。` } };\n}\nconst cut = text.length > MAX_CHARS;\nif (cut) text = text.slice(0, MAX_CHARS);\nreturn { json: { ...$json, page_text: text, chars: plain.length, cut } };"},"id":"98e9e554-67ad-57ae-bdcc-6a40697d41c5","name":"看看抓到了多少","type":"n8n-nodes-base.code","typeVersion":2,"position":[1160,60]},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"loose","version":2},"conditions":[{"id":"c2","leftValue":"={{ $json.problem }}","rightValue":"","operator":{"type":"string","operation":"empty","singleValue":true}}],"combinator":"and"},"options":{}},"id":"6f468e19-447e-5d96-b94f-0a1e4ee0cb39","name":"内容够不够","type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1380,60]},{"parameters":{"promptType":"define","text":"=你是做中文网页转化优化多年的顾问,帮小老板、个体户和运营看他们的官网、活动页、独立站、招生页、公众号文章。下面是一个网页的文字版(从网页源代码转出来的 Markdown),请给它做一次「落地页体检」:打分、指出问题、给出能直接照着改的建议。\n\n【你能看到什么、看不到什么】\n你看到的只是文字和结构:标题层级、段落、链接和按钮上的字、图片的替代文字、表单里的字段。你看不到颜色、字号、排版、图片内容、加载速度、手机上的显示效果。看不到的东西不要评价;确实需要看图或看手机效果才能判断的,写「这一点要你自己打开手机看一眼」。\n\n【打分:5 项,每项 0~20 分,总分 100】\n1. 第一屏和标题:访客 3 秒内能不能看懂卖什么、给谁、有什么好处。\n2. 卖点和证据:好处说得具体吗,有没有数字、案例、对比、过程,还是只有形容词。\n3. 下一步行动:访客该做什么清不清楚;按钮和链接上的字;行动入口出现得早不早、多不多;表单让人填多少东西。\n4. 信任感:真实评价、资质证书、实体地址和电话、售后和退款说明、个人信息怎么用的说明。\n5. 读起来顺不顺:结构、段落长短、套话和行话多不多、重点是不是被埋在大段文字里。\n打分要严格:一个普通的、没认真优化过的页面应该在 50~65 分之间,只有各项都做得扎实才给 80 分以上。\n\n【输出格式】用 Markdown,按下面的顺序,不要加别的开场白:\n## 总分:XX / 100\n| 项目 | 得分 | 一句话理由 |\n(5 行,对应上面 5 项)\n\n## 一句话诊断\n(一句话说清这个页面最大的问题)\n\n## 主要问题\n(3~5 条,每条先用「」引用页面里的原文,再说为什么会让访客流失。像一个懂行的朋友那样直说,可以犀利,但不要挖苦。)\n\n## 10 条改法\n(按「先改这条收益最大」排序。每条三部分:**改哪里**(引用原文或说清位置)→ **改成什么**(直接给出能用的新标题、新按钮文字、新段落,或具体做法)→ **为什么**(一句话)。新文案用网页原来的语言写。)\n\n## 合规提醒\n(检查页面原文里有没有这些问题,逐条引用原文;没有就写「没发现明显问题」:\n- 《广告法》禁止的绝对化用语,比如「最好」「第一」「国家级」「全网最低」;\n- 普通食品、化妆品、保健品宣称治病、治疗或预防疾病;\n- 收集了和这个页面目的无关的个人信息,比如预约却要身份证号、收入,或者没说明个人信息怎么用。)\n\n【硬规矩】\n- 引用的原文必须是下面网页里真有的字,不能改写后再加引号。\n- 不编造页面上没有的事实:销量、客户数、奖项、价格、地址、成立年份都不许编。建议里需要真实数据的地方,用【填你的真实××】占位,例如「已有【填你的真实复购人数】位老顾客回购」。\n- 你给的新文案也不能用绝对化用语,不能宣称疗效。\n- 不给「加在线客服」「做免费试用」「优化 SEO」这种对谁都成立的建议,除非结合这个页面的原文说清为什么、怎么做。\n- 整份报告用简体中文。\n\n【网页信息】\n网址:{{ $json.url }}\n这个页面想让访客做什么:{{ $json.goal || '没填,请你根据页面内容判断' }}\n主要给谁看:{{ $json.audience || '没填,请你根据页面内容判断' }}\n网页标题(title):{{ $json.title || '(没有)' }}\n网页描述(description):{{ $json.description || '(没有)' }}\n程序数出来的:图片 {{ $json.stats.images }} 张,其中 {{ $json.stats.images_without_alt }} 张没写替代文字;表单 {{ $json.stats.forms }} 个,要填的字段 {{ $json.stats.form_fields }} 个;{{ $json.stats.has_viewport ? '有' : '没有' }}手机适配标签(viewport)。{{ $json.cut ? '页面太长,下面只给了前 15000 个字。' : '' }}\n\n【网页文字】\n{{ $json.page_text }}","batching":{}},"id":"81a68ba6-f5cb-555e-a7ad-ef40ecb3dbb6","name":"AI 体检","type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.7,"position":[1600,-60],"retryOnFail":true,"maxTries":2,"waitBetweenTries":3000,"onError":"continueErrorOutput"},{"parameters":{"model":"deepseek-flash","options":{}},"id":"dd5c0ab6-1d4a-565d-8ded-d85e4073dda1","name":"模型","type":"@n8n/n8n-nodes-langchain.lmChatDeepSeek","typeVersion":1,"position":[1600,160]},{"parameters":{"mode":"runOnceForEachItem","jsCode":"// 把 AI 写的 Markdown 里的尖括号转义掉,防止网页里藏的代码借 AI 的回答跑到你的浏览器里\nconst page = $('内容够不够').item.json;\nconst report = String($json.text || '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\nreturn { json: { url: page.url || $('检查网址').item.json.url, report } };"},"id":"be2802f5-ae21-5b30-a5be-c43bc11c84ec","name":"报告转成网页","type":"n8n-nodes-base.code","typeVersion":2,"position":[1860,-60]},{"parameters":{"mode":"markdownToHtml","markdown":"={{ $json.report }}","destinationKey":"report_html","options":{"tables":true,"simpleLineBreaks":true}},"id":"375b3f2d-7b7a-5451-9e74-56a9dabfe1dd","name":"排版","type":"n8n-nodes-base.markdown","typeVersion":1,"position":[2080,-60]},{"parameters":{"operation":"completion","completionTitle":"AI 这次没答上来","completionMessage":"=模型接口报错:{{ String($json.error?.message || $json.error || '未知错误').slice(0, 300) }}。常见原因是 API Key 填错、账户余额不足、模型名写错,或者网页太长超出了模型一次能读的量。过一会儿再试一次,还不行就打开 n8n 的 Executions 看这次执行的详细报错。","options":{}},"id":"b0b68ad8-f1fa-56b8-aa3b-c1873e5fdc91","name":"AI 没答上来","type":"n8n-nodes-base.form","typeVersion":2.5,"position":[1860,180]},{"parameters":{"operation":"completion","respondWith":"showText","responseText":"=<!doctype html><html lang=\"zh-CN\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>落地页体检报告</title>\n<style>body{margin:0;background:#f4f1ea;font:16px/1.75 -apple-system,\"PingFang SC\",\"Microsoft YaHei\",\"Noto Sans CJK SC\",sans-serif;color:#222}\n.box{max-width:820px;margin:24px auto;background:#fff;border:1px solid #ddd5c4;border-radius:10px;padding:28px 34px}\n.url{color:#7a6a4f;font-size:14px;word-break:break-all;margin-bottom:6px}h2{border-left:4px solid #c8792b;padding-left:10px;margin-top:28px;font-size:20px}\ntable{border-collapse:collapse;width:100%;font-size:15px}td,th{border:1px solid #e2dccf;padding:6px 10px;text-align:left}th{background:#faf6ee}td:nth-child(2){white-space:nowrap}\n.tip{color:#8a8070;font-size:13px;margin-top:30px;border-top:1px dashed #ddd;padding-top:12px}</style></head><body><div class=\"box\">\n<div class=\"url\">体检网址:{{ $json.url.replace(/&/g,'&').replace(/</g,'<') }}</div>\n{{ $json.report_html.replace(/href=\"(?!https?:)[^\"]*\"/gi, 'href=\"#\"') }}\n<div class=\"tip\">AI 只看了网页文字,看不到图片、颜色和手机上的效果;打分和建议只作参考。改出来的文案对外发布前,请按《广告法》再核一遍,用 AI 生成的内容按规定做好标识。</div>\n</div></body></html>"},"id":"b6f81009-4170-5f34-b1ab-cf2fe3bdc7db","name":"显示报告","type":"n8n-nodes-base.form","typeVersion":2.5,"position":[2300,-60]},{"parameters":{"operation":"completion","completionTitle":"这个网址没法体检","completionMessage":"={{ $json.problem }}","options":{}},"id":"f6f688ce-0d01-5fb7-8583-a41917dcbdf1","name":"没法体检","type":"n8n-nodes-base.form","typeVersion":2.5,"position":[1600,400]}],"connections":{"填网址":{"main":[[{"node":"检查网址","type":"main","index":0}]]},"检查网址":{"main":[[{"node":"网址能用吗","type":"main","index":0}]]},"网址能用吗":{"main":[[{"node":"抓网页","type":"main","index":0}],[{"node":"没法体检","type":"main","index":0}]]},"抓网页":{"main":[[{"node":"整理网页","type":"main","index":0}]]},"整理网页":{"main":[[{"node":"转成文字","type":"main","index":0}]]},"转成文字":{"main":[[{"node":"看看抓到了多少","type":"main","index":0}]]},"看看抓到了多少":{"main":[[{"node":"内容够不够","type":"main","index":0}]]},"内容够不够":{"main":[[{"node":"AI 体检","type":"main","index":0}],[{"node":"没法体检","type":"main","index":0}]]},"模型":{"ai_languageModel":[[{"node":"AI 体检","type":"ai_languageModel","index":0}]]},"AI 体检":{"main":[[{"node":"报告转成网页","type":"main","index":0}],[{"node":"AI 没答上来","type":"main","index":0}]]},"报告转成网页":{"main":[[{"node":"排版","type":"main","index":0}]]},"排版":{"main":[[{"node":"显示报告","type":"main","index":0}]]}},"settings":{"executionOrder":"v1","timezone":"Asia/Shanghai","saveManualExecutions":true},"pinData":{},"meta":{"templateCredsSetupCompleted":false}}
下载后在 n8n、Dify 里导入;n8n 也可以直接在画布上按 Ctrl+V 粘贴。