mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-02-23 02:55:35 +08:00
Update
This commit is contained in:
parent
1a2d93d97d
commit
addcf40c13
@ -9,10 +9,10 @@ __registry__ = cr = CommandRegistry()
|
|||||||
|
|
||||||
@cr.register('today_in_history', '历史上的今天')
|
@cr.register('today_in_history', '历史上的今天')
|
||||||
def today_in_history(_, ctx_msg):
|
def today_in_history(_, ctx_msg):
|
||||||
core.echo('正在查询,请稍等……', ctx_msg)
|
|
||||||
resp = requests.get('http://tool.lu/todayonhistory/')
|
resp = requests.get('http://tool.lu/todayonhistory/')
|
||||||
ok = False
|
ok = False
|
||||||
if resp.status_code == 200:
|
if resp.status_code == 200:
|
||||||
|
core.echo('历史上的今天:', ctx_msg)
|
||||||
html = etree.HTML(resp.text)
|
html = etree.HTML(resp.text)
|
||||||
li_elems = html.xpath('//ul[@id="tohlis"]/li')
|
li_elems = html.xpath('//ul[@id="tohlis"]/li')
|
||||||
# reply = reduce(lambda x, y: x.text + '\n' + y.text, li_elems)
|
# reply = reduce(lambda x, y: x.text + '\n' + y.text, li_elems)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user