Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/newbie/__init__.py

12 lines
616 B
Python
Raw Normal View History

2020-06-13 12:43:43 +00:00
# -*- coding:utf-8 -*-
import json
import requests
async def new():
try:
url = 'https://minecraft-zh.gamepedia.com/api.php?action=query&list=logevents&letype=newusers&format=json'
text1 = requests.get(url,timeout=10)
file = json.loads(text1.text)
return(file['query']['logevents'][0]['title'] + '\n'+file['query']['logevents'][1]['title']+'\n'+file['query']['logevents'][2]['title'] +'\n'+file['query']['logevents'][3]['title']+'\n'+file['query']['logevents'][4]['title'] + '\n'+'…仅显示前5条内容。')
except Exception as e:
return('发生错误:'+str(e))