You need to sign in or sign up before continuing.
feat(wxhook): 视频/语音/文件下载链路 + type=49 XML 子类型分发
跟图片同范式给视频、语音、文件加上主动下载落盘:
- 视频(type=43): download_attachment + poll wxhelper/video/{msg_id}.*
- 语音(type=34): get_voice_by_msg_id 写入 ~/wxbot-cache/wxhook-voice/
- 文件(type=49 sub=6): download_attachment + poll wxhelper/file/{原文件名}
type=49 大类按 二级分发:
- 6 → 真正的文件下载入口,触发下载
- 74 → 文件上传中占位 (实测发现配对出现),返 None 让上游丢弃避免重复
- 5/57/33/36 → 链接/引用/小程序 placeholder
- 其他 → '[xml:N]'
NormalizedMessage 扩展 file_name/file_size/duration 三个字段,小雷接入时 下游可直接拿到原文件名、字节数和音视频时长,无需再解 XML。
XML 元数据解析走轻量正则 (不上 ElementTree,微信非标 XML 容易报错), 基于实测真实样本验证 (语音 voicelength/voiceformat,视频 playlength/length/md5, 文件 title+totallen+fileext,均含 CDATA / 非 CDATA 两种写法)。
_discover_image_dir 重构成参数化 _discover_wxhelper_dir(kind), 覆盖 image/video/file 三个子目录,语音用 ~/wxbot-cache/wxhook-voice/ 自管。