From 0a2d98b4066832fb12ce430194a899f05d53feeb Mon Sep 17 00:00:00 2001 From: H3CoF6 <1707889225@qq.com> Date: Fri, 13 Feb 2026 23:42:06 +0800 Subject: [PATCH] fix: fix post type error --- frontend/pages/sns.vue | 13 ++++++------- src/wechat_decrypt_tool/routers/sns.py | 6 ++++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/frontend/pages/sns.vue b/frontend/pages/sns.vue index dc45d38..0942d10 100644 --- a/frontend/pages/sns.vue +++ b/frontend/pages/sns.vue @@ -570,14 +570,13 @@ const getSnsMediaUrl = (post, m, idx, rawUrl) => { const mid = String(m?.id || '').trim() if (mid) parts.set('media_id', mid) - const mtype = String(m?.type || '').trim() - if (mtype) parts.set('media_type', mtype) + // const mtype = String(m?.type || '').trim() + // if (mtype) parts.set('media_type', mtype) + + const postType = String(post?.type || '1').trim() + if (postType) parts.set('post_type', postType) + - // if (pick) parts.set('pick', pick) - // if (!pick && snsAvoidOtherPicked.value) { - // parts.set('avoid_picked', '1') - // parts.set('pv', String(snsMediaOverrideRev.value || '0')) - // } if (md5) parts.set('md5', md5) // Bump this when changing backend matching logic to avoid stale cached wrong images. parts.set('v', '7') diff --git a/src/wechat_decrypt_tool/routers/sns.py b/src/wechat_decrypt_tool/routers/sns.py index e3ab552..ab8f345 100644 --- a/src/wechat_decrypt_tool/routers/sns.py +++ b/src/wechat_decrypt_tool/routers/sns.py @@ -105,6 +105,7 @@ def _parse_timeline_xml(xml_text: str, fallback_username: str) -> dict[str, Any] if not xml_str: return out + try: root = ET.fromstring(xml_str) except Exception: @@ -1143,7 +1144,8 @@ async def get_sns_media( avoid_picked: int = 0, post_id: Optional[str] = None, media_id: Optional[str] = None, - media_type: int = 2, + # media_type: int = 2, + post_type: int = 1, pick: Optional[str] = None, md5: Optional[str] = None, url: Optional[str] = None, @@ -1152,7 +1154,7 @@ async def get_sns_media( wxid_dir = _resolve_account_wxid_dir(account_dir) if wxid_dir and post_id and media_id: - deterministic_key = _generate_sns_cache_key(post_id, media_id, media_type) + deterministic_key = _generate_sns_cache_key(post_id, media_id, post_type) exact_match_path = _resolve_sns_cached_image_path_by_cache_key( wxid_dir=wxid_dir,