import{_ as i,c as a,ae as n,o as h}from"./chunks/framework.BzDBnRMZ.js";const g=JSON.parse('{"title":"index","description":"","frontmatter":{"title":"index","order":100,"collapsed":true},"headers":[],"relativePath":"en/dev/api/tools/marshoai_bangumi/index.md","filePath":"en/dev/api/tools/marshoai_bangumi/index.md","lastUpdated":1734175019000}'),t={name:"en/dev/api/tools/marshoai_bangumi/index.md"};function e(l,s,k,p,r,d){return h(),a("div",null,s[0]||(s[0]=[n(`

Module nonebot_plugin_marshoai.tools.marshoai_bangumi


async func fetch_calendar()

Source code or View on 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()

Source code or View on 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 ''
`,7)]))}const o=i(t,[["render",e]]);export{g as __pageData,o as default};