File size: 3,163 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""

bilibili_api.app



手机 APP 相关

"""

import time
from hashlib import md5
from typing import Union

from .utils.utils import get_api
from .utils.credential import Credential
from .utils.network import Api

API = get_api("app")


async def get_loading_images(

    mobi_app: str = "android",

    platform: str = "android",

    height: int = 1920,

    width: int = 1080,

    build: int = 999999999,

    birth: str = "",

    credential: Union[Credential, None] = None,

):
    """

    获取开屏启动画面



    Args:

        build      (int, optional)              : 客户端内部版本号



        mobi_app   (str, optional)              : android / iphone / ipad



        platform   (str, optional)              : android / ios    / ios



        height     (int, optional)              : 屏幕高度



        width      (int, optional)              : 屏幕宽度



        birth      (str, optional)              : 生日日期(四位数,例 0101)



        credential (Credential | None, optional): 凭据. Defaults to None.



    Returns:

        dict: 调用 API 返回的结果

    """
    credential = credential if credential is not None else Credential()

    api = API["splash"]["list"]
    params = {
        "build": build,
        "mobi_app": mobi_app,
        "platform": platform,
        "height": height,
        "width": width,
        "birth": birth,
    }
    return await Api(**api, credential=credential).update_params(**params).result


async def get_loading_images_special(

    mobi_app: str = "android",

    platform: str = "android",

    height: int = 1920,

    width: int = 1080,

    credential: Union[Credential, None] = None,

):
    """

    获取特殊开屏启动画面



    Args:

        mobi_app   (str, optional)              : android / iphone / ipad



        platform   (str, optional)              : android / ios    / ios



        height     (str, optional)              : 屏幕高度



        width      (str, optional)              : 屏幕宽度



        credential (Credential | None, optional): 凭据. Defaults to None.



    Returns:

        dict: 调用 API 返回的结果

    """
    APPKEY = "1d8b6e7d45233436"
    APPSEC = "560c52ccd288fed045859ed18bffd973"

    ts = int(time.time())

    credential = credential if credential is not None else Credential()

    api = API["splash"]["brand"]
    sign_params = (
        "appkey="
        + APPKEY
        + "&mobi_app="
        + mobi_app
        + "&platform="
        + platform
        + "&screen_height="
        + str(height)
        + "&screen_width="
        + str(width)
        + "&ts="
        + str(ts)
        + APPSEC
    )

    sign = md5()
    sign.update(sign_params.encode(encoding="utf-8"))
    sign = sign.hexdigest()

    params = {
        "appkey": APPKEY,
        "mobi_app": mobi_app,
        "platform": platform,
        "screen_height": height,
        "screen_width": width,
        "ts": ts,
        "sign": sign,
    }
    return await Api(**api, credential=credential).update_params(**params).result