From 5043150d9df98f35701f80b18fec429f1c9a21ff Mon Sep 17 00:00:00 2001 From: emmaelise34453-web Date: Mon, 15 Jun 2026 03:18:04 +0800 Subject: [PATCH] feat: extract URL from link messages (app_type=5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, link messages (including WeChat Official Account articles) only showed the title, e.g. [链接] title. Now the URL is also extracted from the XML field and displayed: [链接] title https://mp.weixin.qq.com/s/... This enables downstream workflows to automatically scrape article content from group chat links. --- wechat_cli/core/messages.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wechat_cli/core/messages.py b/wechat_cli/core/messages.py index d62ef33..b3b5599 100644 --- a/wechat_cli/core/messages.py +++ b/wechat_cli/core/messages.py @@ -195,6 +195,9 @@ def _format_app_message_text(content, local_type, is_group, chat_username, chat_ return f"[文件] {title}\n {os.path.join(file_dir, f)}" return f"[文件] {title}" if title else "[文件]" if app_type == 5: + url = _collapse_text(appmsg.findtext('url') or '') + if url: + return f"[链接] {title}\n {url}" if title else f"[链接]\n {url}" return f"[链接] {title}" if title else "[链接]" if app_type in (33, 36, 44): return f"[小程序] {title}" if title else "[小程序]"