AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(extension): clip WeChat picture posts (#756) (#764)
LuoQianhongceca1fef8612
diff --git a/apps/extension/article-clip.test.mjs b/apps/extension/article-clip.test.mjsindex 9d3d3680..40a9af48 100644--- a/apps/extension/article-clip.test.mjs+++ b/apps/extension/article-clip.test.mjs@@ -55,6 +55,103 @@ test("WeChat keeps its account, author, declared cover and lazy image URLs whileexpect(result.clip.publishedAt).toEqual({value:"2025-02-22T23:02:00",precision:"datetime"});});+const picturePost = (name = "wechat-pictures") => {+ const doc=fixture(name), data=JSON.parse(doc.querySelector('#wechat-picture-state').textContent);+ const url=doc.querySelector('meta[property="og:url"]').getAttribute('content');+ const state={pageUrl:url,url:data.link,pictures:data.picture_page_info_list.map(p=>p.cdn_url)};+ return {doc,url,state};+};++for(const [name,count,account] of [["wechat-pictures",5,"Geo优化局"],["wechat-pictures-ten",10,"七点互动"]]) {+ test(`WeChat ${name}: clips the complete declared gallery in order, not just the first rendered image`,()=>{+ const {doc,url,state}=picturePost(name),original=doc.documentElement.outerHTML;+ expect(doc.querySelectorAll('#img_list img')).toHaveLength(1);+ const result=readArticle(doc,url,"公众号",state);+ expect(result.ok).toBe(true);+ expect(result.clip.title).toBe(doc.querySelector('.rich_media_title').textContent);+ expect(result.clip.markdown).toContain(`公众号: ${account}`);+ const images=[...result.clip.markdown.matchAll(/!\[[^\]]*\]\(([^)]+)\)/g)].map(m=>m[1]);+ expect(images).toHaveLength(count);expect(images).toEqual(state.pictures);+ expect(result.clip.markdown).toContain(doc.querySelector('#js_image_desc').textContent.slice(0,30));+ for(const noise of [result.clip.title,"收录于推荐合集","喜欢作者","外围互动提示","不保存的留言","account-avatar.png"]) expect(result.clip.markdown).not.toContain(noise);+ expect(result.clip.markdown).not.toContain(doc.querySelector('meta[property="og:image"]').getAttribute('content'));+ expect(isPlatformClip(result.clip,platformTarget(url))).toBe(true);+ expect(doc.documentElement.outerHTML).toBe(original);+ });+}++test("WeChat picture posts can contain only images and omit unavailable metadata or hidden descriptions",()=>{+ for(const mode of ['empty','missing','hidden']) {+ const {doc,url,state}=picturePost(),description=doc.querySelector('#js_image_desc');+ if(mode==='empty') description.textContent='';+ if(mode==='missing') description.remove();+ if(mode==='hidden') description.setAttribute('hidden','');+ doc.querySelector('#js_wx_follow_nickname').remove();doc.querySelector('#publish_time').remove();+ const result=readArticle(doc,url,"公众号",state);+ expect(result.ok).toBe(true);expect(result.clip.author).toBeUndefined();expect(result.clip.publishedAt).toBeUndefined();+ expect(result.clip.markdown.match(/!\[/g)).toHaveLength(5);+ expect(result.clip.markdown).not.toContain('最近做GEO');expect(result.clip.markdown).not.toContain('公众号:');+ }+});++test("WeChat's heading-free six-picture post uses its source title and keeps the authored first line",()=>{+ const {doc,url,state}=picturePost('wechat-pictures-no-heading'),original=doc.documentElement.outerHTML;+ expect(doc.querySelector('.rich_media_title')).toBeFalsy();+ const result=readArticle(doc,url,'公众号',state);expect(result.ok).toBe(true);+ expect(result.clip.title).toBe('Codex做GEO,真的夯爆了');+ expect(result.clip.markdown).toContain('Codex做GEO,真的夯爆了');+ expect(result.clip.markdown).toContain('团队其实早就想做GEO了');+ expect([...result.clip.markdown.matchAll(/!\[[^\]]*\]\(([^)]+)\)/g)].map(m=>m[1])).toEqual(state.pictures);+ expect(state.pictures).toHaveLength(6);expect(isPlatformClip(result.clip,platformTarget(url))).toBe(true);+ expect(doc.documentElement.outerHTML).toBe(original);+});++test("WeChat picture titles use page metadata when the visual heading is unavailable, without inventing a default",()=>{+ const {doc,url,state}=picturePost(),heading=doc.querySelector('.rich_media_title');+ heading.setAttribute('hidden','');+ expect(readArticle(doc,url,'公众号',state).clip.title).toBe(heading.textContent);+ heading.remove();doc.querySelector('meta[property="og:title"]').setAttribute('content',' ');+ const title=doc.createElement('title');title.textContent='Page-provided picture title';doc.head.appendChild(title);+ expect(readArticle(doc,url,'公众号',state).clip.title).toBe('Page-provided picture title');+ title.remove();expect(readArticle(doc,url,'公众号',state)).toEqual({ok:false,reason:'unreadable'});+});++test("WeChat's hydrated carousel replaces its hidden first-image placeholder",()=>{+ const {doc,url,state}=picturePost(),gallery=doc.querySelector('.img_swiper_area'),initial=doc.querySelector('#img_list');+ const placeholder=doc.createElement('div');placeholder.id='img_swiper_placeholder';placeholder.setAttribute('aria-hidden','true');+ gallery.appendChild(placeholder);placeholder.appendChild(initial);+ const live=doc.createElement('div');live.id='page_top_area';live.innerHTML='<div class="share_media" role="img" aria-label="插图"><img src="https://example.test/rendered-preview.png"></div>';+ gallery.appendChild(live);+ const result=readArticle(doc,url,'公众号',state);expect(result.ok).toBe(true);+ expect(result.clip.markdown.match(/!\[/g)).toHaveLength(5);expect(result.clip.markdown).not.toContain('rendered-preview.png');+});++test("WeChat picture posts reject incomplete or unsafe galleries and stale source snapshots",()=>{+ const {doc,url,state}=picturePost();+ for(const invalid of [undefined,null,{}, {...state,pictures:[]},{...state,pictures:[state.pictures[0],null]},{...state,pictures:[state.pictures[0],'javascript:alert(1)']}]) {+ expect(readArticle(doc,url,"公众号",invalid)).toEqual({ok:false,reason:"incomplete"});+ }+ for(const invalid of [{...state,pageUrl:urls.wechat},{...state,url:urls.wechat}]) expect(readArticle(doc,url,"公众号",invalid)).toEqual({ok:false,reason:"changed"});+});++test("WeChat picture identity checks compare the page and snapshot even when the source URL is an alias",()=>{+ const query='https://mp.weixin.qq.com/s?__biz=MzA%3D%3D&mid=123&idx=1&sn=abc';+ const {doc,url,state}=picturePost(),declared=doc.querySelector('meta[property="og:url"]');+ const aliased={...state,pageUrl:query};+ expect(readArticle(doc,query,'公众号',aliased).ok).toBe(true);+ expect(readArticle(doc,query,'公众号',{...aliased,url:urls.wechat})).toEqual({ok:false,reason:'changed'});+ declared.setAttribute('content',query);+ expect(readArticle(doc,url,'公众号',{...state,url:query}).ok).toBe(true);+ expect(readArticle(doc,url,'公众号',{...state,url:query.replace('mid=123','mid=456')})).toEqual({ok:false,reason:'changed'});+});++test("WeChat hidden picture-post layouts cannot be restored from page state",()=>{+ for(const selector of ['#js_content','#js_image_content','.img_swiper_area','#img_list']) {+ const {doc,url,state}=picturePost();doc.querySelector(selector).setAttribute('hidden','');+ expect(readArticle(doc,url,"公众号",state)).toEqual({ok:false,reason:"unreadable"});+ }+});+test("Sspai retains its update as a quote with displayed time, bold title and complete body after the original article",()=>{const doc=fixture("sspai"),original=doc.body.outerHTML,result=read("sspai",doc);expect(result.ok).toBe(true);diff --git a/apps/extension/fixtures/platforms/wechat-pictures-no-heading.html b/apps/extension/fixtures/platforms/wechat-pictures-no-heading.htmlnew file mode 100644index 00000000..a0edb27b--- /dev/null+++ b/apps/extension/fixtures/platforms/wechat-pictures-no-heading.html@@ -0,0 +1,47 @@+<!doctype html>+<html lang="zh-CN"><head><meta charset="utf-8"><title>Codex做GEO,真的夯爆了</title>+<!-- Reduced heading-free public DOM and gallery from the third URL in Issue #756. -->+<meta property="og:title" content="Codex做GEO,真的夯爆了">+<meta property="og:url" content="https://mp.weixin.qq.com/s/-hnDxCmiAXBPcXEe5tg84A">+<meta property="og:image" content="http://mmbiz.qpic.cn/mmbiz_jpg/DH9wicP1heNluXyyr0SiauyqWfh1GozyXZ5t3jsSVnIKUwuGDjcD13n15tOTqW2s9Xic0Xm0Cx9QtUAlzgXyS0lLNXoGNDBibiaBX8bSD2icpLNWc/0?wx_fmt=jpeg">+</head><body><div id="js_article">+<div class="img_swiper_area"><div id="img_list" class="share_media" style="height: 1061.33px;">+ <div class="swiper_item">+ <div class="swiper_item_img" style="position:relative;">++ <img style="width: 80.01508295625943%;" id="img_item_placeholder" src="https://mmbiz.qpic.cn/mmbiz_jpg/DH9wicP1heNmxPq2XE73RO5tpyibfw8ETRAaPahYS32STBRn26Fic6jOWjLOz1ian5bqiaaibNqs3R6zoUsBuh7wYUE5kbN3MQkvENxse1D2f9w0Y/0?wxfrom=12&wx_fmt=jpg&tp=webp&usePicPrefetch=1">+ </div>+ <div id="img_item_placeholder-loading" class="swiper_item_icon swiper_item_loading delay" style="display: none;"></div>++ </div></div></div>+<div id="js_content"><div id="js_image_content" class="image_content">+<p id="js_image_desc" class="share_notice js_underline_content"><span class="wx_english_text_left">Codex做GEO,真的夯爆了</span><br>最近接了一个做户外太阳能背包的独立站,SKU有几十个。<br>团队其实早就想做GEO了,但一直卡在一个特别现实的问题:<br>到底什么样的内容才算“合格”?<br>产品经理觉得可以,SEO觉得不够,运营又有自己的标准。<br>一篇产品页改了三四版,最后还是在讨论“这句话到底算不算AI友好”。<br>我们换了个思路,先把GEO标准拆成一张可以逐项验证的Checklist,再让它按照清单去检查。<br><br>01|先把“感觉”变成可以打勾的标准<br>我们直接把标准写成可检查的项目,比如:<br>产品页首段是否在80字以内直接回答核心问题<br>是否出现具体参数、测试数据、认证等可验证信息<br>是否大量使用“高品质、性能卓越”这类无法验证的形容词<br>H2/H3是否对应真实用户问题<br>FAQ是否覆盖至少3个购买决策疑虑<br>产品参数是否完整<br>使用场景是否写清楚<br><span class="wx_english_text_left">页面内容和Product Schema是否一致</span><br>这样一来,“好不好”就变成了:<br>符合 / 不符合 / 缺失。<br>Codex负责检查标准,人负责制定标准。<br><br>02|先别急着改,让Codex把“病灶”全部找出来<br>这一步我们特意要求它:只检查,不修改。<br>把整套Checklist交给Codex,让它逐个产品页扫描。<br>最后得到的不是一堆泛泛的“建议优化”,而是一张类似这样的表<br><br>03|拿着问题清单逐条修,不让AI“自由发挥”<br>检查完成以后,再进入修改阶段。<br>而且我们没有让Codex重新“创作一遍产品页”。<br>而是告诉它:<br>只修Checklist里明确指出的问题。<br>比如:<br>缺少续航数据 → 补充真实测试数据。<br>FAQ不够 → 根据已有产品信息补充购买决策问题。<br>首段太长 → 压缩成80字以内的直接答案。<br>Schema和页面信息不一致 → 找出冲突并统一。<br>这样做有个好处:不会出现AI为了优化一个FAQ,顺手把整个产品定位都改掉的情况。<br><br><span class="wx_english_text_left">04|把Checklist做成Automations,定期自动巡检</span><br><br>Codex负责80%的标准化检查,人负责20%的关键决策。<br>把标准写清楚交给Codex去"跑测试",效率完全不是一个量级。<br><a link-id="26df" target="_blank" class="wx_topic_link" data-topicid="mtmsw047-2q1tr5" data-topic="1" href="javascript:;">#codex</a> <a link-id="833e" target="_blank" class="wx_topic_link" data-topicid="mtmsw048-4e8pre" data-topic="1" href="javascript:;">#独立站</a> <a link-id="b7b4" target="_blank" class="wx_topic_link" data-topicid="mtmsw048-g9ratb" data-topic="1" href="javascript:;">#海外市场拓展</a> <a link-id="94a4" target="_blank" class="wx_topic_link" data-topicid="mtmsw048-kaj7tv" data-topic="1" href="javascript:;">#谷歌seo</a> <a link-id="078d" target="_blank" class="wx_topic_link" data-topicid="mtmsw048-pa7c9n" data-topic="1" href="javascript:;">#品牌出海</a> <a link-id="8c2e" target="_blank" class="wx_topic_link" data-topicid="mtmsw048-4ndbn9" data-topic="1" href="javascript:;">#howto入门codex</a></p>+<div class="album_con">收录于推荐合集</div><button>喜欢作者</button><p>外围互动提示</p>+</div></div>+<div role="link" tabindex="0" id="js_wx_follow_nickname" aria-labelledby="js_wx_follow_nickname" aria-describedby="js_wx_follow_tips" class="wx_follow_nickname_normal_font js_wx_tap_highlight wx_tap_link"><span class="nickNameSpan">想要变壮的will</span><span class="wx_follow_nickname_follow_icon"></span></div>+<img class="wx_follow_avatar_pic" src="https://example.test/account-avatar.png">+<div class="interaction_bar"><button>分享</button><p>不保存的留言</p></div>+</div><script type="application/json" id="wechat-picture-state">{+ "link": "https://mp.weixin.qq.com/s/-hnDxCmiAXBPcXEe5tg84A",+ "picture_page_info_list": [+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/DH9wicP1heNmxPq2XE73RO5tpyibfw8ETRAaPahYS32STBRn26Fic6jOWjLOz1ian5bqiaaibNqs3R6zoUsBuh7wYUE5kbN3MQkvENxse1D2f9w0Y/0?wx_fmt=jpeg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/DH9wicP1heNm71NPuKias753uqWHmbNf1Bic77tm4SFnIoicouxrVHHdE3ffnJ2WULxKXTPeXXiahfc3UAZibpjkU9aAVMHWMPR49BicUqhziaD0cPM/0?wx_fmt=jpeg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/DH9wicP1heNnMWOGGuOXNdugM4owpMvJuiafP8q91TmTiaSf3M0WcCxIV9eNWwRDEiawLPKsqDxH4RmibdPmoibsTY4jRofO1nXFJDqTS48P7MvIg/0?wx_fmt=jpeg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/DH9wicP1heNlZDmTpdNQojl9nEWlWUnR8yEIIz5aubfUibBRwGwGWpf1VkHu4iaGVic0XDwsv9NFkqbiaEAUCibiaLytsbINxurk0kjqqM1hkia7AtU/0?wx_fmt=jpeg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/DH9wicP1heNkicZdhFOTQKtP1ABMibn0CiavpxoXNIk9qgQSJPOhuIwian6oPUoTtExeuI7Vlnms5tHIvtaBGT9ORXSG81ZqJ8jl1l8BezmILpeg/0?wx_fmt=jpeg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/DH9wicP1heNlgvrib3ZV1bqym4CoHhMVSDk322XHJmKTIYTSBeVcQDwmfiaedugiae8ZkpDOFC4WjdlWJeFQ9MdRyRtCWM45zYxTWJg0ftDNGPk/0?wx_fmt=jpeg"+ }+ ]+}</script>+</body></html>diff --git a/apps/extension/fixtures/platforms/wechat-pictures-ten.html b/apps/extension/fixtures/platforms/wechat-pictures-ten.htmlnew file mode 100644index 00000000..dedf290d--- /dev/null+++ b/apps/extension/fixtures/platforms/wechat-pictures-ten.html@@ -0,0 +1,62 @@+<!doctype html>+<html lang="zh-CN"><head><meta charset="utf-8">+<!-- Reduced public DOM and declared gallery from Issue #756; no account/session data. -->+<meta property="og:title" content="做GEO,怎么找到客户真正会问的问题?">+<meta property="og:url" content="https://mp.weixin.qq.com/s/yStZ8wCpJtRxBCYmPON-Og">+<meta property="og:image" content="http://mmbiz.qpic.cn/mmbiz_jpg/1iaFciccykC1MMldRLaotSN3eu7M9iba1hvPzvDBHT5MbicnxLbtYnPxnORI8HUh0vDv56qPPiaMTibcibaLyDQZDNj0ttsgSTF2HCl6jKP4QichVHI/0?wx_fmt=jpeg">+</head><body><div id="js_article">+<div class="img_swiper_area"><div id="img_list" class="share_media" style="height: 1061.33px;">+ <div class="swiper_item">+ <div class="swiper_item_img" style="position:relative;">++ <img style="width: 100%;" id="img_item_placeholder" src="https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1PuJiaxGyicYmEcGibfIgXfGUMvuugTQor7sicQRiaaHe6jaKOYiazOvI1qoB2dZCibgibzWlWKl1Uj48Y7fSBkWvMFUPzy4TUdWmSlIicQ/0?wxfrom=12&wx_fmt=png&tp=webp&usePicPrefetch=1">+ </div>+ <div id="img_item_placeholder-loading" class="swiper_item_icon swiper_item_loading delay" style="display: none;"></div>++ </div></div>+</div>+<div id="js_content"><div id="js_image_content" class="image_content">+<h1 class="rich_media_title">做GEO,怎么找到客户真正会问的问题?</h1>+<p id="js_image_desc" class="share_notice js_underline_content">很多企业做GEO,习惯先让AI批量生成几百个问题,但“AI能生成”不等于“客户真的会问”。更有效的做法,是先从销售、客服、搜索和公开讨论里找到真实问题,再用AI扩展、归一和判断价值,最后检查企业有没有答案、页面和证据去承接。<br><br><a link-id="7fdb" target="_blank" class="wx_topic_link" data-topicid="mtzlt5gs-ws79lt" data-topic="1" href="javascript:;">#GEO</a> <a link-id="ba9b" target="_blank" class="wx_topic_link" data-topicid="mtzlt5lm-9g7nqs" data-topic="1" href="javascript:;">#生成式引擎优化</a> <a link-id="3ac4" target="_blank" class="wx_topic_link" data-topicid="mtzlt5rb-zfaxwa" data-topic="1" href="javascript:;">#AEO</a> <a link-id="a70e" target="_blank" class="wx_topic_link" data-topicid="mtzlt6au-gl6lc0" data-topic="1" href="javascript:;">#AI搜索优化</a> <a link-id="1827" target="_blank" class="wx_topic_link" data-topicid="mtzlt6g5-qaw3oz" data-topic="1" href="javascript:;">#GEO问题研究</a> <a link-id="f2ea" target="_blank" class="wx_topic_link" data-topicid="mtzlt70x-77e5ld" data-topic="1" href="javascript:;">#企业AI</a> <a link-id="4ed8" target="_blank" class="wx_topic_link" data-topicid="mtzlt76f-fjjkc1" data-topic="1" href="javascript:;">#AI营销</a></p>+<div class="album_con">收录于推荐合集</div><button>喜欢作者</button><p>外围互动提示</p>+<span id="publish_time">9月13日</span>+</div></div>+<div role="link" tabindex="0" id="js_wx_follow_nickname" aria-labelledby="js_wx_follow_nickname" aria-describedby="js_wx_follow_tips" class="wx_follow_nickname_normal_font js_wx_tap_highlight wx_tap_link"><span class="nickNameSpan">七点互动</span><span class="wx_follow_nickname_follow_icon"></span></div>+<img class="wx_follow_avatar_pic" src="https://example.test/account-avatar.png">+<div class="interaction_bar"><button>分享</button><p>不保存的留言</p></div>+</div><script type="application/json" id="wechat-picture-state">{+ "link": "https://mp.weixin.qq.com/s/yStZ8wCpJtRxBCYmPON-Og",+ "picture_page_info_list": [+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1PuJiaxGyicYmEcGibfIgXfGUMvuugTQor7sicQRiaaHe6jaKOYiazOvI1qoB2dZCibgibzWlWKl1Uj48Y7fSBkWvMFUPzy4TUdWmSlIicQ/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1Mnz7EnGgiafnaCksgoE07pJGicXrW2NbezHB3LHudVjMiaY3yBbQFmCVcY7NN62FTPRJyydHeryAbj0ZpibO05yGQHa9FCvZWXgX4/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_png/1iaFciccykC1PicHkzuSVFjaLYyA7zAtsmedVwohXia0Dic9wGGkDTMqLQ4gngsaicJnDd2NTB5TKt8AoaueozRF0D8RJsxYg02kbPlweXRE9nKXA/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1OnFGhCj6UuP6g3R9ygn5OI4PrI92G8XliamZkuuJ4kJcPRO4PSOk1UCVwQicve9iczFEaybOsn5nsg1SGS29qicqwcMxufEgQcpwc/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1MOVyaD8h2wh91zib8VIwSlMms9nrP9b2ODsKhZwHiaEFmKOkicUia6pY9Cox1mBPkn0Py6enVAQvjTKx2mxicickNYZPXULnsicuBXCo/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1NKBLyOLyicOgZUDgjRW7zRtqdq3OCiaXKiaxOn30QbIctDV0UOVQVGx9GRX5dLnQSlHZVMxEFjL0n9FyrzAPuBnKoaG2iaRIt6DYY/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_png/1iaFciccykC1OnksnxD8wjjQ2xoicJ3Hq6ylEIzAQAQ4pj2WzYO7icFgkH8JxQsYvoDTJyic8b73fash973uDj81g8K42PfYJsFl2bJoLjw3Gmlo/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1PibLMsbJMXzXwqU9lyiaIDuTVw1jomdhv6P9GVBZ7cX9gqgw54pzEaA8Jwv9g7xm7plQUBZEjYjMH97AzxaZ6bDibzP7EGXqwGhU/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_png/1iaFciccykC1PAe0qAe9MDWrrf50MAtg61pbYBvllVGYtRl60wiahPYJFDEaI1H7q8Fib91cmQCudLaI3hYWPTWw4TwndbeTy9xL1fXiaF9de1bY/0?wx_fmt=png"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_png/1iaFciccykC1O6DFs4GJl5tkKGMQKDahiap5p4iaQ0wX3uCmbetehxzhFibfGSHy3wyxhK0G2icI3C3ICnmlwoWiacn7r60icobKBNMynuZEaC6aawI/0?wx_fmt=png"+ }+ ]+}</script>+</body></html>diff --git a/apps/extension/fixtures/platforms/wechat-pictures.html b/apps/extension/fixtures/platforms/wechat-pictures.htmlnew file mode 100644index 00000000..8cf21afc--- /dev/null+++ b/apps/extension/fixtures/platforms/wechat-pictures.html@@ -0,0 +1,47 @@+<!doctype html>+<html lang="zh-CN"><head><meta charset="utf-8">+<!-- Reduced public DOM and declared gallery from Issue #756; no account/session data. -->+<meta property="og:title" content="豆包信源大洗牌后,我用这套方法做GEO">+<meta property="og:url" content="https://mp.weixin.qq.com/s/FXFDv4PbDrq3ueGLVWU0-A">+<meta property="og:image" content="https://mmbiz.qpic.cn/mmbiz_jpg/ibrevicNauKAXp3RS9lBGg9iajnuPtXCnfPib0mdVf1R4rEltriccgsgjwjuaROibmwCvkXV8126cU6askGskAaDXwnDRCAjxOsOGySU2wXcE0c5o/0?wx_fmt=jpeg">+</head><body><div id="js_article">+<div class="img_swiper_area"><div id="img_list" class="share_media" style="height: 1061.33px;">+ <div class="swiper_item">+ <div class="swiper_item_img" style="position:relative;">++ <img style="width: 100%;" id="img_item_placeholder" src="https://mmbiz.qpic.cn/mmbiz_jpg/ibrevicNauKAUVcfEKmBDt3fuvMVicw2trzSNCb041xBoIYUO0RuPdu4Kc5IVxoUpXOE7daChTgaavEHGN3r7aic7UhxmggUum85xKO7v0R4kh0/0?from=appmsg&wxfrom=12&wx_fmt=jpg&usePicPrefetch=1">+ </div>+ <div id="img_item_placeholder-loading" class="swiper_item_icon swiper_item_loading delay" style="display: none;"></div>++ </div></div>+</div>+<div id="js_content"><div id="js_image_content" class="image_content">+<h1 class="rich_media_title">豆包信源大洗牌后,我用这套方法做GEO</h1>+<p id="js_image_desc" class="share_notice js_underline_content">最近做GEO的品牌都有同感:豆包对内容的引用量直线下降,铺量、关键词、稿件都没少,效果越来越小。<br>▌2026上半年,豆包信源体系三次跃迁<br>核心:信源成了新的排名算法。<br>3·15曝光「AI投毒」后,百家号、搜狐号等软文重灾区被大幅降权。<br>Seed 2.1 上线后,索引层、检索层、生成层重构,旧方法全失效,我重做了一套。<br><br> 一、官网和POI对齐<br>Seed 2.1 后,主体和POI的工商信息对不上,直接不进索引。<br>官网重构,把品牌主体信息、工商资质、POI坐标做结构化标注。<br><br> 二、权威媒体交叉验证<br>单条信源不被采信,需2个以上独立第三方验证。<br>把权威媒体采买纳入固定预算,官网发一遍,再选两到三家媒体发。央媒被引用概率是普通自媒体的8到10倍。EEAT权威度占30%,资质、案例、口碑都要有。<br><br>三、视频信源拿抖音80%的移动端流量<br>国货护肤品牌监测:豆包592次引用里,抖音占79.46%,字节系超80%。<br>重心从图文挪到视频,三类内容:产品测评、实拍体验、案例拆解。关键信息用字幕标黄,让OCR和语音解析抓取。<br><br>四、PC和移动端分开铺信源<br>之前一套内容通发两端,效果都差。<br>数据监测:豆包App端抖音域名引用占比28.62%,Web端只有11.85%,换端口权重差一倍多。<br><br>✅ PC端是官网、百科、权威媒体,权重偏好专业性。 ✅ 移动端在字节生态内,权重偏好及时性和转化链路。<br>两组信源重叠率低于30%,PC做深做专业,移动做短做决策引导。<br><br>五、六大维度自检<br>✅ 实体一致性100%。 ✅ 地理权重消费类标到商圈级。 ✅ 多元信源至少铺三个平台。 ✅ EEAT权威度三件套缺一不可。 ✅ 内容80%以上要有三级标题+数据+本地案例。 ✅ 用户意图覆盖达80%以上场景。<br><br>六、赶在商业化前布局<br>6月豆包月活5.28亿,7月广告系统内测,商业和自然流量分池。自然排名靠付费买不到,拼的是信源质量。<br>当年抖音商业化前布局的品牌,自然流量成本几乎为零,全面开放后翻了3到5倍。豆包窗口期还有一到两个季度,重构信源体系成本最低,AI推荐率涨了80%。<br><a link-id="55a3" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb8-crhljt" data-topic="1" href="javascript:;">#GEO优化</a> <a link-id="1f4b" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb9-cghpz2" data-topic="1" href="javascript:;">#AI搜索优化</a> <a link-id="1eb4" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb9-k9crmr" data-topic="1" href="javascript:;">#豆包SEO</a> <a link-id="5198" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb9-9lhoxa" data-topic="1" href="javascript:;">#企业获客</a> <a link-id="8957" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb9-fsxnct" data-topic="1" href="javascript:;">#B端营销</a> <a link-id="7681" target="_blank" class="wx_topic_link" data-topicid="mtwd9bb9-jnjb6b" data-topic="1" href="javascript:;">#信源布局</a></p>+<div class="album_con">收录于推荐合集</div><button>喜欢作者</button><p>外围互动提示</p>+<span id="publish_time">9月11日</span>+</div></div>+<div role="link" tabindex="0" id="js_wx_follow_nickname" aria-labelledby="js_wx_follow_nickname" aria-describedby="js_wx_follow_tips" class="wx_follow_nickname_normal_font js_wx_tap_highlight wx_tap_link"><span class="nickNameSpan">Geo优化局</span><span class="wx_follow_nickname_follow_icon"></span></div>+<img class="wx_follow_avatar_pic" src="https://example.test/account-avatar.png">+<div class="interaction_bar"><button>分享</button><p>不保存的留言</p></div>+</div><script type="application/json" id="wechat-picture-state">{+ "link": "https://mp.weixin.qq.com/s/FXFDv4PbDrq3ueGLVWU0-A",+ "picture_page_info_list": [+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/ibrevicNauKAUVcfEKmBDt3fuvMVicw2trzSNCb041xBoIYUO0RuPdu4Kc5IVxoUpXOE7daChTgaavEHGN3r7aic7UhxmggUum85xKO7v0R4kh0/0?wx_fmt=jpeg&from=appmsg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/ibrevicNauKAU7QY7Wos3Q1DrgHXD8W8zNjws2tqvq3jyjKuYCJ0AKhYmajV8exkegs4jbXeA4DGtaKuxNC1bHTyNpryvIEMnnKvqIIGn46vU/0?wx_fmt=jpeg&from=appmsg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/ibrevicNauKAWvev7DhdG5V0O3pPqs8XqzkCerjXrrWwDMFhUDbNh7Ue7DIj1MEKG5DFOFr1coe3DwvOYWBvHSHyuTPVq88icOk6Zs4kzQAYg4/0?wx_fmt=jpeg&from=appmsg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/sz_mmbiz_jpg/ibrevicNauKAVm0ru9k5yUOppWDDFXj6h6jibdl8iakZh9wLicXZAgbCSdv3mKqUzsRwYjFBEI3BvwDrhA6RpbN6UKcckVPPz7fpymYicbT8aLDQ8/0?wx_fmt=jpeg&from=appmsg"+ },+ {+ "cdn_url": "https://mmbiz.qpic.cn/mmbiz_jpg/ibrevicNauKAUYHUIiav0rhw0WuabS5U75GVIy6KG8iacrjPq4dPXKZlYC7cdonFhic22eniawfkCfw117aRaggsCMLHaPYgv68WhlnLqk8ic7ao0k/0?wx_fmt=jpeg&from=appmsg"+ }+ ]+}</script>+</body></html>diff --git a/apps/extension/platform-save.test.mjs b/apps/extension/platform-save.test.mjsindex 8deae9e8..b766d335 100644--- a/apps/extension/platform-save.test.mjs+++ b/apps/extension/platform-save.test.mjs@@ -363,6 +363,51 @@ test("a new platform toolbar still saves a valid selection instead of its full aexpect(h.calls.creates[0].contentMarkdown).not.toContain("环境不好");});+for(const [fixture,imageCount] of [["wechat-pictures",5],["wechat-pictures-ten",10],["wechat-pictures-no-heading",6]]) {+ for(const entry of ["toolbar","menu"]) test(`WeChat ${fixture} ${entry} saves every original picture through the existing attachment pipeline`,async()=>{+ const doc=createDocument(readFileSync(new URL(`./fixtures/platforms/${fixture}.html`,import.meta.url),'utf8'));+ const pageUrl=doc.querySelector('meta[property="og:url"]').getAttribute('content');+ const declared=JSON.parse(doc.querySelector('#wechat-picture-state').textContent);+ const h=harness({platform:'wechat',fixture,pageUrl,prepare:(_doc,window)=>{window.cgiDataNew=declared;}});+ const result=await h[entry]();expect(entry==='toolbar' ? result.ok : result.kind).toBe(entry==='toolbar' ? true : 'success');+ expect(h.calls.creates).toHaveLength(1);expect(h.calls.creates[0].title).toBe(doc.querySelector('.rich_media_title')?.textContent || doc.querySelector('meta[property="og:title"]').getAttribute('content'));+ expect(h.calls.creates[0].tags).toEqual(['web-clip','wechat']);+ expect(h.calls.uploads).toHaveLength(imageCount);expect(h.calls.saves).toHaveLength(1);+ const markdown=h.calls.saves[0].contentMarkdown;+ expect([...markdown.matchAll(/!\[[^\]]*\]\(([^)]+)\)/g)].map(m=>m[1])).toEqual(Array.from({length:imageCount},(_,i)=>`/api/v1/resources/res_${i+1}/blob`));+ expect(markdown).not.toContain('收录于推荐合集');expect(markdown).not.toContain('account-avatar.png');+ });+}++test("WeChat reads the full declared gallery rather than the site's twenty-picture preview",async()=>{+ const h=harness({platform:'wechat',fixture:'wechat-pictures',pageUrl:'https://mp.weixin.qq.com/s/FXFDv4PbDrq3ueGLVWU0-A',prepare:(doc,window)=>{+ const data=JSON.parse(doc.querySelector('#wechat-picture-state').textContent);+ data.picture_page_info_list=Array.from({length:21},(_,i)=>({cdn_url:`https://example.test/gallery/${i}.png`}));+ window.cgiDataNew=data;window.picture_page_info_list=data.picture_page_info_list.slice(0,20);+ }});+ expect((await h.toolbar()).ok).toBe(true);expect(h.calls.uploads).toHaveLength(21);+});++test("WeChat malformed picture state fails before creating a note",async()=>{+ for(const data of [undefined,{picture_page_info_list:[]},{link:urls.wechat,picture_page_info_list:[{cdn_url:'https://example.test/first.png'},{}]}]) {+ const h=harness({platform:'wechat',fixture:'wechat-pictures',pageUrl:'https://mp.weixin.qq.com/s/FXFDv4PbDrq3ueGLVWU0-A',prepare:(_doc,window)=>{window.cgiDataNew=data;}});+ expect((await h.toolbar()).ok).toBe(false);expect(h.calls.creates).toHaveLength(0);expect(h.calls.uploads).toHaveLength(0);+ }+});++test("WeChat conflicting declared aliases fail before saving, while matching aliases still archive the gallery",async()=>{+ const pageUrl='https://mp.weixin.qq.com/s?__biz=MzA%3D%3D&mid=123&idx=1&sn=abc';+ for(const conflict of [false,true]) {+ const h=harness({platform:'wechat',fixture:'wechat-pictures',pageUrl,prepare:(doc,window)=>{+ const data=JSON.parse(doc.querySelector('#wechat-picture-state').textContent);+ if(conflict)data.link=urls.wechat;window.cgiDataNew=data;+ }});+ const result=await h.toolbar();expect(result.ok).toBe(!conflict);+ expect(h.calls.creates).toHaveLength(conflict ? 0 : 1);expect(h.calls.uploads).toHaveLength(conflict ? 0 : 5);+ if(conflict)expect(result.message).toBe('platformPageChanged');+ }+});+test("Xiaoyuzhou saves the current client route using MAIN-world props while bootstrap JSON stays old", async () => {const id = "6a8ef24e1352af56ff3c83f3";const pageUrl = `https://www.xiaoyuzhoufm.com/episode/${id}`;diff --git a/apps/extension/src/article-clip.ts b/apps/extension/src/article-clip.tsindex eca49ff2..7ec1d6f4 100644--- a/apps/extension/src/article-clip.ts+++ b/apps/extension/src/article-clip.ts@@ -1,4 +1,4 @@-import { markdownText, markdownUrl, platformElementHidden, platformHtmlMarkdown, platformReadableCopy, platformTarget, platformText, publishedTime, safePlatformUrl, type PlatformRead, type PublishedTime } from "./platform-clip";+import { markdownText, markdownUrl, platformElementHidden, platformHtmlMarkdown, platformReadableCopy, platformTarget, platformText, publishedTime, safePlatformUrl, type PlatformRead, type PlatformTarget, type PublishedTime } from "./platform-clip";import { restoreWechatHeadings } from "./wechat-headings";const readableText = (node: Element | null) => node ? platformText(platformReadableCopy(node)) : "";@@ -79,23 +79,34 @@ export const articlePublishedTime = (node: Element | null): PublishedTime | undereturn publishedTime(clean);};-export const readArticle = (doc: Document, pageUrl: string, accountLabel: string): PlatformRead => {+const articleIdentityMatches = (expected: PlatformTarget, candidate: PlatformTarget | null): boolean => {+ if (!candidate || candidate.platform !== expected.platform) return false;+ // WeChat short and query identities cannot be compared solely by spelling.+ return candidate.id === expected.id || (expected.platform === "wechat" && candidate.id.includes("/") !== expected.id.includes("/"));+};++export const readArticle = (doc: Document, pageUrl: string, accountLabel: string, wechatPictureState?: unknown): PlatformRead => {const target = platformTarget(pageUrl);if (!target || !["wechat","sspai","juejin"].includes(target.platform)) return {ok:false,reason:"not-target"};const declared = doc.querySelector('link[rel="canonical"]')?.getAttribute("href") || doc.querySelector('meta[property="og:url"]')?.getAttribute("content");- if (declared) {- const identity = platformTarget(safePlatformUrl(declared, target.url));- // WeChat short and query links are aliases that cannot be resolved solely- // from their spelling. Compare identities only within the same URL form.- const alias = target.platform === "wechat" && identity?.platform === "wechat" && identity.id.includes("/") !== target.id.includes("/");- if (!alias && (identity?.platform !== target.platform || identity.id !== target.id)) return {ok:false,reason:"changed"};- }+ const declaredTarget = declared ? platformTarget(safePlatformUrl(declared, target.url)) : null;+ if (declared && !articleIdentityMatches(target,declaredTarget)) return {ok:false,reason:"changed"};let titleNode: Element | null, body: Element | null, authorNode: Element | null, timeNode: Element | null;+ let pictureContent: Element | null = null;let account = "";if (target.platform === "wechat") {- titleNode=doc.querySelector("#activity-name"); body=doc.querySelector("#js_content");+ pictureContent=doc.querySelector("#js_content #js_image_content");+ if (pictureContent) {+ // Hydration hides #img_list and mounts a live carousel beside it.+ const gallery=Array.from(doc.querySelectorAll("#js_article .img_swiper_area .share_media")).find(node=>!platformElementHidden(node));+ if (platformElementHidden(pictureContent) || !gallery) return {ok:false,reason:"unreadable"};+ titleNode=pictureContent.querySelector(".rich_media_title");+ body=pictureContent.querySelector("#js_image_desc") || doc.createElement("div");+ } else {+ titleNode=doc.querySelector("#activity-name"); body=doc.querySelector("#js_content");+ }authorNode=doc.querySelector("#js_author_name"); timeNode=doc.querySelector("#publish_time");- account=readableText(doc.querySelector("#js_name"));+ account=readableText(doc.querySelector(pictureContent ? "#js_wx_follow_nickname .nickNameSpan" : "#js_name"));} else if (target.platform === "sspai") {const article=doc.querySelector("article.normal-article");titleNode=article?.querySelector("#article-title") || null;@@ -111,14 +122,26 @@ export const readArticle = (doc: Document, pageUrl: string, accountLabel: stringauthorNode=article?.querySelector(".author-name .name") || null;timeNode=article?.querySelector('meta[itemprop="datePublished"],time') || null;}- const title=readableText(titleNode);+ const title=readableText(titleNode) || (pictureContent+ ? doc.querySelector('meta[property="og:title"]')?.getAttribute("content")?.trim() || doc.title.trim()+ : "");if (!title || !body) return {ok:false,reason:"unreadable"};+ let pictures: string[] | undefined;+ if (pictureContent) {+ const state=wechatPictureState as {pageUrl?: unknown;url?: unknown;pictures?: unknown} | null;+ if (!state || typeof state.pageUrl !== "string" || typeof state.url !== "string" || !Array.isArray(state.pictures)) return {ok:false,reason:"incomplete"};+ if (state.pageUrl !== pageUrl) return {ok:false,reason:"changed"};+ const identity=platformTarget(state.url);+ if (!articleIdentityMatches(target,identity) || (declaredTarget && !articleIdentityMatches(declaredTarget,identity))) return {ok:false,reason:"changed"};+ pictures=state.pictures.map(value=>typeof value === "string" ? safePlatformUrl(value,target.url) : "");+ if (!pictures.length || pictures.some(url=>!url)) return {ok:false,reason:"incomplete"};+ }const clean=platformReadableCopy(body);- if(target.platform === "wechat") cleanWechatContent(clean,target.url);+ if(target.platform === "wechat" && !pictureContent) cleanWechatContent(clean,target.url);// These are article controls, not text/code authored into the article.Array.from(clean.querySelectorAll('.code-block-extension-header, .code-block-extension-copyCodeBtn')).forEach(n=>n.remove());const markdown=platformHtmlMarkdown(clean,target.url);- if (!markdown) return {ok:false,reason:"unreadable"};+ if (!markdown && !pictures) return {ok:false,reason:"unreadable"};let author=readableText(authorNode);if (target.platform === "sspai") author=[...new Set(Array.from(body.closest("article.normal-article")?.querySelectorAll(".article__header__author .ss__user__nickname > span") || []).map(readableText).filter(Boolean))].join(", ");// Juejin publishes the author in its article-scoped schema metadata, even@@ -126,11 +149,12 @@ export const readArticle = (doc: Document, pageUrl: string, accountLabel: stringif (!author && target.platform === "juejin") author=doc.querySelector('article.article [itemprop="author"] meta[itemprop="name"]')?.getAttribute("content")?.trim() || "";const parts: string[]=[];if (account) parts.push(`${markdownText(accountLabel)}: ${markdownText(account)}`);- if (target.platform === "wechat") {+ if (pictures) parts.push(pictures.map(url=>`})`).join("\n\n"));+ else if (target.platform === "wechat") {const cover=safePlatformUrl(doc.querySelector('meta[property="og:image"]')?.getAttribute("content") || "",target.url);if (cover && !Array.from(clean.querySelectorAll("img")).some(img=>["data-src","data-original","src"].some(a=>safePlatformUrl(img.getAttribute(a)||"",target.url)===cover))) parts.push(`})`);}- parts.push(markdown);+ if (markdown) parts.push(markdown);if(target.platform === "sspai") parts.push(...sspaiUpdateMarkdown(body,target.url));return {ok:true,clip:{...target,title,author:author || undefined,publishedAt:articlePublishedTime(timeNode),markdown:parts.join("\n\n"),tags:["web-clip",target.platform],completeness:"complete"}};};diff --git a/apps/extension/src/background.ts b/apps/extension/src/background.tsindex ab6676da..4ae39c6a 100644--- a/apps/extension/src/background.ts+++ b/apps/extension/src/background.ts@@ -95,6 +95,7 @@ import { t } from "./i18n";import { readXiaoyuzhouStateInPage } from "./xiaoyuzhou-clip";import { jikeLoginPost } from "./jike-clip";import { readJikeWebStateInPage } from "./jike-web-state";+import { readWechatPictureStateInPage } from "./wechat-picture-state";import { bossLoginRequired } from "./boss-clip";import {isPlatformClip,@@ -1347,12 +1348,15 @@ const readPlatformFromPage = async (tabId: number, target: PlatformTarget, selec? (await chrome.scripting.executeScript({ target: { tabId, frameIds: [0] }, world: "MAIN", func: readXiaoyuzhouStateInPage }))[0]?.result: undefined;const jikeState = target.platform === "jike" && usesJikeWebState(sourceUrl) ? await readJikeWebState(tabId,target.id) : undefined;+ const wechatPictureState = target.platform === "wechat"+ ? (await chrome.scripting.executeScript({ target: { tabId, frameIds: [0] }, world: "MAIN", func: readWechatPictureStateInPage }))[0]?.result+ : undefined;await chrome.scripting.executeScript({target: { tabId, frameIds: [0] },func: (payload: unknown) => {(globalThis as { __edgeeverPlatformClipPayload?: unknown }).__edgeeverPlatformClipPayload = payload;},- args: [{ requestId, url: target.url, sourceUrl, selectionFirst, selectionText, xiaoyuzhouState, jikeState }],+ args: [{ requestId, url: target.url, sourceUrl, selectionFirst, selectionText, xiaoyuzhouState, jikeState, wechatPictureState }],});await chrome.scripting.executeScript({ target: { tabId, frameIds: [0] }, files: ["assets/capture-platform.js"] });};diff --git a/apps/extension/src/capture-platform.ts b/apps/extension/src/capture-platform.tsindex 43c199ae..6c76b62f 100644--- a/apps/extension/src/capture-platform.ts+++ b/apps/extension/src/capture-platform.ts@@ -15,7 +15,7 @@ import { platformHtmlMarkdown, platformTarget, type PlatformLabels, type Platfor// Built as a standalone IIFE and injected only after a user action.(() => {const root = globalThis as typeof globalThis & {- __edgeeverPlatformClipPayload?: { requestId?: string; url?: string; selectionFirst?: boolean; selectionText?: string; sourceUrl?: string; xiaoyuzhouState?: unknown; jikeState?: unknown };+ __edgeeverPlatformClipPayload?: { requestId?: string; url?: string; selectionFirst?: boolean; selectionText?: string; sourceUrl?: string; xiaoyuzhouState?: unknown; jikeState?: unknown; wechatPictureState?: unknown };};const payload = root.__edgeeverPlatformClipPayload;delete root.__edgeeverPlatformClipPayload;@@ -43,7 +43,7 @@ import { platformHtmlMarkdown, platformTarget, type PlatformLabels, type Platforcase "xiaoyuzhou": return readXiaoyuzhou(document, location.href, labels, payload.xiaoyuzhouState);case "boss": return readBoss(document, location.href);case "xueqiu": return readXueqiu(document, expected, location.href);- case "wechat": case "sspai": case "juejin": return readArticle(document, location.href, t("platformOfficialAccountLabel"));+ case "wechat": case "sspai": case "juejin": return readArticle(document, location.href, t("platformOfficialAccountLabel"), payload.wechatPictureState);case "jike": return readJike(document, location.href, expected, payload.jikeState);case "douban": return readDouban(document, expected, location.href, t("platformListSourceLabel"));default: return readSocial(document, expected);diff --git a/apps/extension/src/wechat-picture-state.ts b/apps/extension/src/wechat-picture-state.tsnew file mode 100644index 00000000..7d512bab--- /dev/null+++ b/apps/extension/src/wechat-picture-state.ts@@ -0,0 +1,16 @@+/** Read the declared gallery, not the partially rendered carousel or its cover. */+export function readWechatPictureStateInPage() {+ // Closure-free: scripting.executeScript serializes this function into MAIN.+ if (new URL(location.href).origin !== "https://mp.weixin.qq.com"+ || !document.querySelector("#js_content #js_image_content")) return null;+ const data = (window as unknown as { cgiDataNew?: unknown }).cgiDataNew;+ if (!data || typeof data !== "object") return null;+ const post = data as Record<string, unknown>;+ if (typeof post.link !== "string" || !Array.isArray(post.picture_page_info_list)) return null;+ const pictures: string[] = [];+ for (const value of post.picture_page_info_list) {+ if (!value || typeof value !== "object" || typeof value.cdn_url !== "string") return null;+ pictures.push(value.cdn_url);+ }+ return { pageUrl: location.href, url: post.link, pictures };+}diff --git a/docs/changes/2026-11-02-wechat-picture-clipping.md b/docs/changes/2026-11-02-wechat-picture-clipping.mdnew file mode 100644index 00000000..7706ce9d--- /dev/null+++ b/docs/changes/2026-11-02-wechat-picture-clipping.md@@ -0,0 +1,27 @@+# Clip WeChat picture posts++[简体中文](2026-11-02-wechat-picture-clipping.zh-CN.md) · [Issue #756](https://github.com/tianma-if/edgeever/issues/756)++## Problem and outcome++WeChat picture posts place their title, description and carousel differently from ordinary articles, causing rejected clips or missing images. Preserve the source title, visible description, available account/author/publication metadata and every original image in source order.++## Changes++1. Resolve the title from the visible heading, then the page's `og:title`, then its document title. If all are empty, keep the unreadable-content error rather than inventing a default. Descriptions may be empty; preserve authored text, including a first line that repeats the title. Do not add the separate share cover or surrounding interaction controls.+2. Use the existing MAIN-world probe to read the current post URL and `cgiDataNew.picture_page_info_list[].cdn_url`, without executing site inline scripts. Compare the snapshot with both the source URL and declared page identity: retain short/query aliases, but reject conflicting identities within the same URL form. Missing, empty or malformed image lists and non-HTTP(S) image URLs report incomplete content rather than saving a partial gallery. Unreadable posts never fall back to whole-page capture.+3. Reuse toolbar/context-menu entry points, selection priority, notebook selection and image archival, including existing limits and partial-image feedback. Ordinary WeChat articles and other platforms retain their behavior.++## Decisions and boundaries++Read the complete original-image list from loaded page state because a virtual carousel mounts only part of the gallery. Check the visible carousel rather than relying solely on a placeholder that becomes hidden after rendering.++No new permissions, dependencies or image-count/size limits; no API, database, authentication, native-client or release-mechanism changes. Existing notes are not rewritten. Roll back the WeChat reader and probe wiring; already clipped notes remain ordinary usable notes.++## Acceptance++Titles, descriptions, image order and attachment persistence meet the expected behavior, with ordinary-article regression coverage passing. Native toolbar clipping and reopening are verified on macOS Chromium. Windows/Firefox runtime and native context-menu clicks remain unverified.++## Screenshot++diff --git a/docs/changes/2026-11-02-wechat-picture-clipping.zh-CN.md b/docs/changes/2026-11-02-wechat-picture-clipping.zh-CN.mdnew file mode 100644index 00000000..ce87edcf--- /dev/null+++ b/docs/changes/2026-11-02-wechat-picture-clipping.zh-CN.md@@ -0,0 +1,27 @@+# 微信公众号贴图剪藏++[English](2026-11-02-wechat-picture-clipping.md) · [Issue #756](https://github.com/tianma-if/edgeever/issues/756)++## 问题与目标++微信贴图消息的标题、说明和轮播布局不同于普通文章,原读取器会拒绝剪藏或遗漏图片。支持保留来源标题、可见说明、可用的公众号/作者/发布时间,以及按原顺序排列的全部原图。++## 变更范围++1. 标题依次取可见标题、页面 `og:title`、文档标题;均为空时仍提示无法读取,不虚构默认标题。说明可以为空,已有说明原样保留,包括与标题相同的首行;不额外插入分享封面或外围互动内容。+2. 通过既有 MAIN world 探针读取当前消息 URL 和 `cgiDataNew.picture_page_info_list[].cdn_url`,不执行站点内联脚本。快照同时与来源 URL、页面声明身份比对:保留长短链接别名,同一种 URL 形式中的身份冲突须拒绝。图片列表缺失、为空、结构异常或含非 HTTP(S) 地址时提示内容不完整,不保存残缺轮播;不可读贴图不回退整页采集。+3. 复用工具栏/右键入口、选区优先级、笔记本选择和图片转存流程,保留既有额度及部分图片失败提示。普通微信文章和其他平台保持原行为。++## 决策与边界++完整原图列表以页面已加载状态为准,避免虚拟轮播只挂载部分图片而漏图;可读性检查使用可见轮播,不把渲染后隐藏的占位节点作为唯一依据。++不新增权限、依赖或图片数量/体积上限,不修改 API、数据库、认证、原生客户端及发布机制,不重写已有笔记。回滚只需撤回微信读取器及探针接线,已剪藏笔记仍可作为普通笔记使用。++## 验收结论++标题、说明、图片顺序和附件保存符合预期,普通文章回归通过;macOS Chromium 原生工具栏剪藏及重开显示已验证。Windows/Firefox 运行时和原生右键菜单点击未验证。++## 截图++diff --git a/docs/changes/evidence/2026-11-02-wechat-picture-clipping/saved-gallery.png b/docs/changes/evidence/2026-11-02-wechat-picture-clipping/saved-gallery.pngnew file mode 100644index 00000000..2a2968b0Binary files /dev/null and b/docs/changes/evidence/2026-11-02-wechat-picture-clipping/saved-gallery.png differ