From da888ff020805a38a17e5f83705aeb42ffa992ba Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sun, 7 Mar 2021 15:24:17 +0800 Subject: =?UTF-8?q?=E2=99=BB=EF=B8=8F=E2=9A=A1=EF=B8=8F=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84=20Service=EF=BC=8C=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/rich/__init__.py | 24 ++++++++++++++++++++---- ATRI/plugins/rich/data_source.py | 16 ++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'ATRI/plugins/rich') diff --git a/ATRI/plugins/rich/__init__.py b/ATRI/plugins/rich/__init__.py index d20a234..7f9369e 100644 --- a/ATRI/plugins/rich/__init__.py +++ b/ATRI/plugins/rich/__init__.py @@ -1,3 +1,19 @@ +#!/usr/bin/env python3 +# -*- coding:utf-8 -*- +''' +File: __init__.py +Created Date: 2021-02-07 09:34:23 +Author: Kyomotoi +Email: Kyomotoiowo@gmail.com +License: GPLv3 +Project: https://github.com/Kyomotoi/ATRI +-------- +Last Modified: Sunday, 7th March 2021 3:14:28 pm +Modified By: Kyomotoi (kyomotoiowo@gmail.com) +-------- +Copyright (c) 2021 Kyomotoi +''' + import re import json from aiohttp.client import ClientSession @@ -25,7 +41,7 @@ bilibili_rich = on_message( @bilibili_rich.handle() async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: global waiting_list - msg = str(event.raw_message) + msg = str(event.raw_message).replace("\\", "") user = event.user_id bv = False @@ -45,9 +61,9 @@ async def _bilibili_rich(bot: Bot, event: MessageEvent) -> None: except: return else: - bv_url = re.findall(r"(..........b23...\S+\=)", msg) - bv_url = bv_url[0].replace("\\", "") - print(bv_url) + patt = r"(?:(?:https?|ftp):\/\/)?[\w/\-?=%.]+\.[\w/\-&?=%.]+" + bv_url = re.findall(patt, msg) + bv_url = bv_url[3] async with ClientSession() as session: async with session.get( url=bv_url) as r: diff --git a/ATRI/plugins/rich/data_source.py b/ATRI/plugins/rich/data_source.py index 32ac219..d3e7d6e 100644 --- a/ATRI/plugins/rich/data_source.py +++ b/ATRI/plugins/rich/data_source.py @@ -1,3 +1,19 @@ +#!/usr/bin/env python3 +# -*- coding:utf-8 -*- +''' +File: data_source.py +Created Date: 2021-02-07 09:34:31 +Author: Kyomotoi +Email: Kyomotoiowo@gmail.com +License: GPLv3 +Project: https://github.com/Kyomotoi/ATRI +-------- +Last Modified: Sunday, 7th March 2021 3:14:31 pm +Modified By: Kyomotoi (kyomotoiowo@gmail.com) +-------- +Copyright (c) 2021 Kyomotoi +''' + table = 'fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' tr = {} for i in range(58): -- cgit v1.2.3