🐛 Fix honey wiki data parse

This commit is contained in:
xtaodada 2023-04-25 19:52:16 +08:00
parent 30ea0b99cb
commit ac879cc353
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 4 additions and 1 deletions

View File

@ -208,7 +208,7 @@ class WikiModel(Model):
chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0] chaos_data = re.findall(r"sortable_data\.push\((.*?)\);\s*sortable_cur_page", response.text)[0]
json_data = jsonlib.loads(chaos_data) # 转为 json json_data = jsonlib.loads(chaos_data) # 转为 json
for data in json_data: # 遍历 json for data in json_data: # 遍历 json
data_name = re.findall(r">(.*)<", data[1])[0] # 获取 Model 的名称 data_name = re.findall(r">(.*)<", data[1])[0].replace("\r", "") # 获取 Model 的名称
if with_url: # 如果需要返回对应的 url if with_url: # 如果需要返回对应的 url
data_url = HONEY_HOST.join(re.findall(r"\"(.*?)\"", data[0])[0]) data_url = HONEY_HOST.join(re.findall(r"\"(.*?)\"", data[0])[0])
await queue.put((data_name, data_url)) await queue.put((data_name, data_url))

View File

@ -202,6 +202,9 @@ class WishLogPlugin(Plugin.Conversation):
if message.document: if message.document:
await self.import_from_file(user, message) await self.import_from_file(user, message)
return ConversationHandler.END return ConversationHandler.END
if not message.text:
await message.reply_text("请发送文件或链接")
return INPUT_URL
authkey = from_url_get_authkey(message.text) authkey = from_url_get_authkey(message.text)
reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后") reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后")
await message.reply_chat_action(ChatAction.TYPING) await message.reply_chat_action(ChatAction.TYPING)