wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.64k stars 233 forks source link

[Bug]: 卡片链接无法提取数据 #411

Open ZhangRaymond opened 1 year ago

ZhangRaymond commented 1 year ago

Environment

- wechaty:0.10.7
- wechaty-puppet:  0.4.23
- wechaty-puppet-service: 0.8.10
- wechaty-plugin-contrib: 0.0.25
- token type: padlocal|wxwork|xp: work pro
- the version of wechaty docker container: [0.65]

Description

目前正在用测试token进行开发。

问题:在对URL和小程序信息使用msg.to_url_link() 和 msg.to_mini_program() 提取数据时报错,traceback如下图,无法获取message_url对应的pyload。

异常项:在登录过程中报Warning:there is not registed blueprint in the plugins, so bot will not start the web service。怀疑这里无法加载blueprint和web service导致了上面的问题。

请问该如何解决?

2023-07-18 00:15:51,082 - Message - INFO - Message to UrlLink
Error: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
  File "/Users/ray/projects/GPT-Fast-Reader/wechatyHandler.py", line 181, in on_message
    url_link = await msg.to_url_link()
  File "/Users/ray/Library/Python/3.9/lib/python/site-packages/wechaty/user/message.py", line 696, in to_url_link
    payload = await self.puppet.message_url(self.message_id)
  File "/Users/ray/Library/Python/3.9/lib/python/site-packages/wechaty_puppet_service/puppet.py", line 497, in message_url
    payload_data = json.loads(response.url_link)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

253882636-f35d4278-4469-4379-8c29-c0034c5d5eed

Minimum reproducible code

async def on_message(self, msg: Message):            
     if msg.type() == MessageType.MESSAGE_TYPE_URL:
            logger.info(f"[GetMessage]: URL消息 | @{talker_name} | {msg} ")

            url_link = await msg.to_url_link()
            title = url_link.title()
            description = url_link.description()
            url = url_link.url()
ZhangRaymond commented 1 year ago

@wj-Mcat @huan 辛苦看一下~

su-chang commented 1 year ago

@wj-Mcat 有空帮忙看下这个问题么?