# index | 小棉智能
可爱，智能且易扩展

Skip to content

# 模块 `nonebot_plugin_marshoai.tools.marshoai_bangumi` ​

### async func `fetch_calendar()` ​

源代码 或 在GitHub上查看
python

    async def fetch_calendar():
        url = 'https://api.bgm.tv/calendar'
        headers = {'User-Agent': 'LiteyukiStudio/nonebot-plugin-marshoai (https://github.com/LiteyukiStudio/nonebot-plugin-marshoai)'}
        async with httpx.AsyncClient() as client:
            response = await client.get(url, headers=headers)
            return response.json()

### async func `get_bangumi_news()` ​

源代码 或 在GitHub上查看
python

    async def get_bangumi_news():
        result = await fetch_calendar()
        info = ''
        try:
            for i in result:
                weekday = i['weekday']['cn']
                info += f'{weekday}:'
                items = i['items']
                for item in items:
                    name = item['name_cn']
                    info += f'《{name}》'
                info += '\n'
            return info
        except Exception as e:
            traceback.print_exc()
            return ''