From ff1b681311d16f9dd3bf6131c0dd20fa210d9301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E9=98=BF=E6=B1=9F=28Relakkes?= =?UTF-8?q?=29?= Date: Fri, 26 Dec 2025 00:47:20 +0800 Subject: [PATCH] fix: weibo get note image fixed --- media_platform/weibo/core.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/media_platform/weibo/core.py b/media_platform/weibo/core.py index 9bea3f5..08c19ab 100644 --- a/media_platform/weibo/core.py +++ b/media_platform/weibo/core.py @@ -276,11 +276,18 @@ class WeiboCrawler(AbstractCrawler): utils.logger.info(f"[WeiboCrawler.get_note_images] Crawling image mode is not enabled") return - pics: Dict = mblog.get("pics") + pics: List = mblog.get("pics") if not pics: return for pic in pics: - url = pic.get("url") + if isinstance(pic, str): + url = pic + pid = url.split("/")[-1].split(".")[0] + elif isinstance(pic, dict): + url = pic.get("url") + pid = pic.get("pid", "") + else: + continue if not url: continue content = await self.wb_client.get_note_image(url) @@ -288,7 +295,7 @@ class WeiboCrawler(AbstractCrawler): utils.logger.info(f"[WeiboCrawler.get_note_images] Sleeping for {config.CRAWLER_MAX_SLEEP_SEC} seconds after fetching image") if content != None: extension_file_name = url.split(".")[-1] - await weibo_store.update_weibo_note_image(pic["pid"], content, extension_file_name) + await weibo_store.update_weibo_note_image(pid, content, extension_file_name) async def get_creators_and_notes(self) -> None: """