mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 12:51:04 +00:00
🐛 xtao-some wiki 使用腾讯翻译
This commit is contained in:
parent
d52a7c9324
commit
9d7ba664d1
@ -78,7 +78,9 @@ async def wiki(context):
|
||||
wiki_time = wiki_json['query']['search'][0]['timestamp'].replace('T', ' ').replace('Z', ' ')
|
||||
try:
|
||||
await context.edit("正在生成翻译中 . . .")
|
||||
wiki_content = trans(to_lang=lang).translate(clear_emojis(wiki_content))
|
||||
USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0"
|
||||
headers = {"user-agent": USER_AGENT}
|
||||
wiki_content = json.loads(requests.get("https://xtaolink.cn/git/m/t.php?lang=" + lang + '&text=' + clear_emojis(wiki_content), headers=headers).content.decode("utf-8"))['data']['target_text']
|
||||
message = '词条: [' + wiki_title + '](https://zh.wikipedia.org/zh-cn/' + wiki_title + ')\n\n' + wiki_content + '...\n\n此词条最后修订于 ' + wiki_time
|
||||
except ValueError:
|
||||
await context.edit("出错了呜呜呜 ~ 找不到目标语言,请更正配置文件中的错误。")
|
||||
|
Loading…
Reference in New Issue
Block a user