File size: 3,464 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
"""

bilibili_api



哔哩哔哩的各种 API 调用便捷整合(视频、动态、直播等),另外附加一些常用的功能。

"""

import asyncio
import platform

from .utils.sync import sync
from .utils.credential_refresh import Credential
from .utils.picture import Picture
from .utils.short import get_real_url
from .utils.parse_link import ResourceType, parse_link
from .utils.aid_bvid_transformer import aid2bvid, bvid2aid
from .utils.danmaku import DmMode, Danmaku, DmFontSize, SpecialDanmaku
from .utils.network import (
    HEADERS,
    get_session,
    set_session,
    get_aiohttp_session,
    set_aiohttp_session,
    get_httpx_sync_session,
    set_httpx_sync_session
)
from .errors import (
    LoginError,
    ApiException,
    ArgsException,
    LiveException,
    NetworkException,
    ResponseException,
    VideoUploadException,
    ResponseCodeException,
    DanmakuClosedException,
    CredentialNoBuvid3Exception,
    CredentialNoBiliJctException,
    DynamicExceedImagesException,
    CredentialNoSessdataException,
    CredentialNoDedeUserIDException,
)
from . import (
    app,
    ass,
    hot,
    game,
    live,
    note,
    rank,
    show,
    user,
    vote,
    audio,
    emoji,
    login,
    manga,
    music,
    topic,
    video,
    cheese,
    client,
    search,
    article,
    bangumi,
    comment,
    dynamic,
    session,
    festival,
    homepage,
    settings,
    watchroom,
    live_area,
    video_tag,
    black_room,
    login_func,
    video_zone,
    favorite_list,
    channel_series,
    video_uploader,
    creative_center,
    article_category,
    interactive_video,
    audio_uploader,
)

BILIBILI_API_VERSION = "16.2.0"

# 如果系统为 Windows,则修改默认策略,以解决代理报错问题
if "windows" in platform.system().lower():
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())  # type: ignore

__all__ = [
    "ApiException",
    "ArgsException",
    "BILIBILI_API_VERSION",
    "Credential",
    "CredentialNoBiliJctException",
    "CredentialNoBuvid3Exception",
    "CredentialNoDedeUserIDException",
    "CredentialNoSessdataException",
    "Danmaku",
    "DanmakuClosedException",
    "DmFontSize",
    "DmMode",
    "DynamicExceedImagesException",
    "HEADERS",
    "LiveException",
    "LoginError",
    "NetworkException",
    "Picture",
    "ResourceType",
    "ResponseCodeException",
    "ResponseException",
    "SpecialDanmaku",
    "VideoUploadException",
    "aid2bvid",
    "app",
    "article",
    "article_category",
    "ass",
    "audio",
    "audio_uploader",
    "bangumi",
    "black_room",
    "bvid2aid",
    "channel_series",
    "cheese",
    "client",
    "comment",
    "creative_center",
    "dynamic",
    "emoji",
    "favorite_list",
    "festival",
    "game",
    "get_aiohttp_session",
    "get_real_url",
    "get_session",
    "homepage",
    "hot",
    "interactive_video",
    "live",
    "live_area",
    "login",
    "login_func",
    "manga",
    "music",
    "note",
    "parse_link",
    "rank",
    "search",
    "session",
    "set_aiohttp_session",
    "set_session",
    "settings",
    "show",
    "sync",
    "topic",
    "user",
    "video",
    "video_tag",
    "video_uploader",
    "video_zone",
    "vote",
    "watchroom",
]