fix: 识别并标记隐私保护文章(仅内部分享可见) - #181
Open
Weidows wants to merge 1 commit into
Open
Conversation
微信公众号新增了SPA隐私文章页面类型,内容通过 Vue 动态加载, 不包含传统的 #js_article 结构。validateHTMLContent 目前无法识别 此类页面,导致 _status 显示为空。 新增检测逻辑:当页面包含 <div id="app"> 挂载点(无 #js_article) 时,返回 Exception 状态并标记为「隐私保护,仅内部分享可见」, 通过现有的 download:exception → onStatusChange → updateArticleStatus 链路正确更新文章的 _status 字段。
Author
|
分析时使用的示例文章链接(SPA 隐私文章页面,内容通过 Vue 动态加载): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题描述
有的文章抓取后,文章状态显示为空。这是因为微信公众号新增了一种 SPA 隐私文章 页面类型,内容通过 Vue 动态加载(vite + vue 构建),页面不包含传统的
#js_article元素和window.cgiDataNew数据。当前
validateHTMLContent无法识别这种页面类型,走到最后一个else分支返回['Error', null],导致:_status字段永远不会被更新(始终为空)分析
抓取示例文章并分析 HTML 结构发现:
<div id="js_article">和内嵌的window.cgiDataNew<div id="app"></div>作为 Vue 挂载点,内容通过private.*.jsJS 包动态加载appmsg_skin_default appmsg_style_default修复
在
validateHTMLContent中新增检测逻辑:当页面包含<div id="app">挂载点(且不匹配前面已知结构)时,返回['Exception', '隐私保护,仅内部分享可见']。通过已有的异常处理链:
validateHTMLContent → Exception with msg → download:exception → onStatusChange → updateArticleStatus正确地将文章的
_status更新为「隐私保护,仅内部分享可见」,让用户在表格中直观地看到文章状态。测试
#js_article):仍返回Success.weui-msg含删除提示):仍返回Deleted<div id="app">,无#js_article):返回Exception+ 提示信息.weui-msg含其他提示):仍返回Exception#app容器:#js_article优先匹配,仍返回SuccessError相关 issue
Fixes #(issue 号,如有)