跳转至

电视收视率

TVMapping

字段映射 实时电视收视率

TV

TV(
    source: Annotated[
        Literal["央视", "卫视"], "", True
    ] = "央视",
    verbose: Annotated[Optional[bool], "", False] = False,
    logger: Annotated[Optional[Callable], "", False] = None,
    **kwargs: Annotated[Any, "", False]
)

查询 实时电视收视率

Notes
from wisecon.movie import *

# 查询 央视实时电视收视率
data = TV(source="央视").load()
data.to_frame(chinese_column=True)

# 查询 卫视实时电视收视率
data = TV(source="卫视").load()
data.to_frame(chinese_column=True)

Parameters:

Name Type Description Default
source Annotated[Literal['央视', '卫视'], '', True]

央视 or 卫视

'央视'
verbose Annotated[Optional[bool], '', False]

是否打印日志

False
logger Annotated[Optional[Callable], '', False]

自定义日志

None
**kwargs Annotated[Any, '', False]

其他参数

{}
Source code in wisecon\movie\tv.py
def __init__(
        self,
        source: Annotated[Literal["央视", "卫视"], "", True] = "央视",
        verbose: Annotated[Optional[bool], "", False] = False,
        logger: Annotated[Optional[Callable], "", False] = None,
        **kwargs: Annotated[Any, "", False],
):
    """
    Notes:
        ```python
        from wisecon.movie import *

        # 查询 央视实时电视收视率
        data = TV(source="央视").load()
        data.to_frame(chinese_column=True)

        # 查询 卫视实时电视收视率
        data = TV(source="卫视").load()
        data.to_frame(chinese_column=True)
        ```

    Args:
        source: 央视 or 卫视
        verbose: 是否打印日志
        logger: 自定义日志
        **kwargs: 其他参数
    """
    self.source = source
    self.mapping = TVMapping()
    self.verbose = verbose
    self.logger = logger
    self.kwargs = kwargs
    self.request_set(
        response_type="json",
        description="实时电视收视率",
    )

types

types()
Source code in wisecon\movie\tv.py
def types(self):
    """"""
    mapping = {"央视": 0, "卫视": 1}
    return mapping[self.source]