File size: 1,063 Bytes
0aee47a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
"""
bilibili_api.festival
节日专门页相关
"""
from typing import Optional
from .utils.credential import Credential
from .utils.initial_state import get_initial_state
from .video import Video
class Festival:
"""
节日专门页
Attributes:
fes_id (str) : 节日专门页编号
credential (Credential): 凭证类
"""
def __init__(self, fes_id: str, credential: Optional[Credential] = None) -> None:
"""
Args:
fes_id (str): 节日专门页编号
credential (Credential, optional): 凭据类. Defaults to None.
"""
self.fes_id = fes_id
self.credential = credential if credential else Credential()
async def get_info(self) -> dict:
"""
获取节日信息
Returns:
dict: 调用 API 返回的结果
"""
return (await get_initial_state(
f"https://www.bilibili.com/festival/{self.fes_id}",
credential=self.credential
))[0]
|