diff --git a/list.json b/list.json index 2b1d450..56d2613 100644 --- a/list.json +++ b/list.json @@ -162,13 +162,13 @@ }, { "name": "resou", - "version": "1.0", + "version": "1.2", "section": "daily", - "maintainer": "KorenKrita", - "size": "5 kb", + "maintainer": "KorenKrita、xtaodada", + "size": "6.1 kb", "supported": true, - "des-short": "微博,知乎,抖音实时热搜。", - "des": "命令:wbrs,zhrs,dyrs。" + "des-short": "微博,知乎,抖音实时热搜,B站实时排行榜。", + "des": "命令:wbrs,zhrs,dyrs,brank。" }, { "name": "whois", diff --git a/resou.py b/resou.py index ee3fd64..8348c18 100644 --- a/resou.py +++ b/resou.py @@ -1,6 +1,5 @@ import json from requests import get -from pagermaid import bot, log from pagermaid.listener import listener @@ -11,7 +10,17 @@ async def netease(context): req = get("https://tenapi.cn/zhihuresou") if req.status_code == 200: data = json.loads(req.text) - res = '知乎实时热搜榜:' + '\n\n1.' + '「' + data['list']['1']['query'] + '」' + '\n2.' + '「' + data['list']['2']['query'] + '」' + '\n3.' + '「' + data['list']['3']['query'] + '」' + '\n4.' + '「' + data['list']['4']['query'] + '」' + '\n5.' + '「' + data['list']['5']['query'] + '」' + '\n6.' + '「' + data['list']['6']['query'] + '」' + '\n7.' + '「' + data['list']['7']['query'] + '」' + '\n8.' + '「' + data['list']['8']['query'] + '」' + '\n9.' + '「' + data['list']['9']['query'] + '」' + '\n10.' + '「' + data['list']['10']['query'] + '」' + res = '知乎实时热搜榜:' + '\n\n1.' + '「' + data['list']['1'][ + 'query'] + '」' + '\n2.' + '「' + data['list']['2'][ + 'query'] + '」' + '\n3.' + '「' + data['list']['3'][ + 'query'] + '」' + '\n4.' + '「' + data['list']['4'][ + 'query'] + '」' + '\n5.' + '「' + data['list']['5'][ + 'query'] + '」' + '\n6.' + '「' + data['list']['6'][ + 'query'] + '」' + '\n7.' + '「' + data['list']['7'][ + 'query'] + '」' + '\n8.' + '「' + data['list']['8'][ + 'query'] + '」' + '\n9.' + '「' + data['list']['9'][ + 'query'] + '」' + '\n10.' + '「' + data['list']['10'][ + 'query'] + '」' await context.edit(res, parse_mode='html', link_preview=False) else: await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") @@ -24,7 +33,21 @@ async def netease(context): req = get("https://tenapi.cn/resou") if req.status_code == 200: data = json.loads(req.text) - res = '微博实时热搜榜:' + '\n\n1.' + '「' + data['list']['1']['name'] + '」' + ' 热度:' + data['list']['1']['hot'] + '\n2.' + '「' + data['list']['2']['name'] + '」' + ' 热度:' + data['list']['2']['hot'] + '\n3.' + '「' + data['list']['3']['name'] + '」' + ' 热度:' + data['list']['3']['hot'] + '\n4.' + '「' + data['list']['4']['name'] + '」' + ' 热度:' + data['list']['4']['hot'] + '\n5.' + '「' + data['list']['5']['name'] + '」' + ' 热度:' + data['list']['5']['hot'] + '\n6.' + '「' + data['list']['6']['name'] + '」' + ' 热度:' + data['list']['6']['hot'] + '\n7.' + '「' + data['list']['7']['name'] + '」' + ' 热度:' + data['list']['7']['hot'] + '\n8.' + '「' + data['list']['8']['name'] + '」' + ' 热度:' + data['list']['8']['hot'] + '\n9.' + '「' + data['list']['9']['name'] + '」' + ' 热度:' + data['list']['9']['hot'] + '\n10.' + '「' + data['list']['10']['name'] + '」' + ' 热度:' + data['list']['10']['hot'] + res = '微博实时热搜榜:' + '\n\n1.' + '「' + data['list']['1'][ + 'name'] + '」' + ' 热度:' + data['list']['1']['hot'] + '\n2.' + '「' + data['list']['2']['name'] + '」' + ' 热度:' + data['list']['2'][ + 'hot'] + '\n3.' + '「' + data['list']['3'][ + 'name'] + '」' + ' 热度:' + data['list']['3']['hot'] + '\n4.' + '「' + data['list']['4']['name'] + '」' + ' 热度:' + data['list']['4'][ + 'hot'] + '\n5.' + '「' + data['list']['5'][ + 'name'] + '」' + ' 热度:' + data['list']['5']['hot'] + '\n6.' + '「' + data['list']['6']['name'] + '」' + ' 热度:' + data['list']['6'][ + 'hot'] + '\n7.' + '「' + data['list']['7'][ + 'name'] + '」' + ' 热度:' + data['list']['7']['hot'] + '\n8.' + '「' + data['list']['8']['name'] + '」' + ' 热度:' + data['list']['8'][ + 'hot'] + '\n9.' + '「' + data['list']['9'][ + 'name'] + '」' + ' 热度:' + data['list']['9']['hot'] + '\n10.' + '「' + data['list']['10']['name'] + '」' + ' 热度:' + data['list']['10']['hot'] await context.edit(res, parse_mode='html', link_preview=True) else: await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") @@ -37,7 +60,31 @@ async def netease(context): req = get("https://tenapi.cn/douyinresou") if req.status_code == 200: data = json.loads(req.text) - res = '抖音实时热搜榜:' + '\n\n1.' + data['list']['1']['name'] + ' 热度:' + str(data['list']['1']['hot']) + '\n2.' + data['list']['2']['name'] + ' 热度:' + str(data['list']['2']['hot']) + '\n3.' + data['list']['3']['name'] + ' 热度:' + str (data['list']['3']['hot']) + '\n4.' + data['list']['4']['name'] + ' 热度:' + str(data['list']['4']['hot']) + '\n5.' + data['list']['5']['name'] + ' 热度:' + str(data['list']['5']['hot']) + '\n6.' + data['list']['6']['name'] + ' 热度:' + str(data['list']['6']['hot']) + '\n7.' + data['list']['7']['name'] + ' 热度:' + str(data['list']['7']['hot']) + '\n8.' + data['list']['8']['name'] + ' 热度:' + str(data['list']['8']['hot']) + '\n9.' + data['list']['9']['name'] + ' 热度:' + str(data['list']['9']['hot']) + '\n10.' + data['list']['10']['name'] + ' 热度:' + str(data['list']['10']['hot']) + res = '抖音实时热搜榜:' + '\n\n1.' + data['list']['1']['name'] + ' 热度:' + str(data['list']['1']['hot']) + '\n2.' + \ + data['list']['2']['name'] + ' 热度:' + str(data['list']['2']['hot']) + '\n3.' + data['list']['3'][ + 'name'] + ' 热度:' + str(data['list']['3']['hot']) + '\n4.' + data['list']['4'][ + 'name'] + ' 热度:' + str(data['list']['4']['hot']) + '\n5.' + data['list']['5'][ + 'name'] + ' 热度:' + str(data['list']['5']['hot']) + '\n6.' + data['list']['6'][ + 'name'] + ' 热度:' + str(data['list']['6']['hot']) + '\n7.' + data['list']['7'][ + 'name'] + ' 热度:' + str(data['list']['7']['hot']) + '\n8.' + data['list']['8'][ + 'name'] + ' 热度:' + str(data['list']['8']['hot']) + '\n9.' + data['list']['9'][ + 'name'] + ' 热度:' + str(data['list']['9']['hot']) + '\n10.' + data['list']['10'][ + 'name'] + ' 热度:' + str(data['list']['10']['hot']) await context.edit(res, parse_mode='html', link_preview=True) else: await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") + +@listener(is_plugin=True, outgoing=True, command="brank", + description="B站排行榜。") +async def brank(context): + await context.edit("获取中 . . .") + req = get("https://api.imjad.cn/bilibili/v2/?get=rank&type=all") + if req.status_code == 200: + data = json.loads(req.content)['rank']['list'] + res = [] + for num in range(0, 9): + res.extend([str(num + 1) + '.「' + + data[num]['title'] + '」 - ' + data[num]['author']]) + await context.edit('B站实时排行榜:\n\n' + '\n'.join(res), parse_mode='html', link_preview=False) + else: + await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。") \ No newline at end of file