Code

import datetime
from botpy.message import Message
from playwright.async_api import async_playwright

async def get_history(self, message: Message):
    day = str(datetime.datetime.now())[5:10].replace('-', '')
    url = 'http://www.people.com.cn/GB/historic/{}/'.format(day)
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(url)
        a = await page.locator("td.t14l14").inner_text()
        await browser.close()
        await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)

async def get_someday_history(self, message: Message, day):
    url = 'http://www.people.com.cn/GB/historic/{}/'.format(str(day))
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(url)
        a = await page.locator("td.t14l14").inner_text()
        await browser.close()
        await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)
import datetime
from botpy.message import Message
from playwright.async_api import async_playwright

async def get_history(self, message: Message):
    day = str(datetime.datetime.now())[5:10].replace('-', '')
    url = 'http://www.people.com.cn/GB/historic/{}/'.format(day)
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(url)
        a = await page.locator("td.t14l14").inner_text()
        await browser.close()
        await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)

async def get_someday_history(self, message: Message, day):
    url = 'http://www.people.com.cn/GB/historic/{}/'.format(str(day))
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto(url)
        a = await page.locator("td.t14l14").inner_text()
        await browser.close()
        await self.api.post_message(channel_id=message.channel_id, content=a[:-1], msg_id=message.id)