Skip to content

Commit

Permalink
chore: 格式化脚本,更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemo2011 committed Jun 28, 2022
1 parent 2fbc298 commit d8293b3
Show file tree
Hide file tree
Showing 45 changed files with 1,364 additions and 1,131 deletions.
5 changes: 1 addition & 4 deletions bilibili_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
from .utils.sync import sync
from .utils.network_httpx import get_session, set_session

HEADERS = {
"User-Agent": "Mozilla/5.0",
"Referer": "https://bilibili.com"
}
HEADERS = {"User-Agent": "Mozilla/5.0", "Referer": "https://bilibili.com"}

# 支持嵌套事件
nest_asyncio.apply()
Expand Down
52 changes: 38 additions & 14 deletions bilibili_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
from hashlib import md5
import time

API = get_api('app')
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: Credential = None):
async def get_loading_images(
mobi_app: str = "android",
platform: str = "android",
height: int = 1920,
width: int = 1080,
build: int = 999999999,
birth: str = "",
credential: Credential = None,
):
"""
获取开屏启动画面
Expand All @@ -39,13 +44,18 @@ async def get_loading_images(mobi_app: str = "android", platform: str = "android
"platform": platform,
"height": height,
"width": width,
"birth": birth
"birth": birth,
}
return await request('GET', api['url'], params, credential=credential)
return await request("GET", api["url"], params, credential=credential)

async def get_loading_images_special(mobi_app: str = "android", platform: str = "android",
height: int = 1920, width: int = 1080,
credential: Credential = None):

async def get_loading_images_special(
mobi_app: str = "android",
platform: str = "android",
height: int = 1920,
width: int = 1080,
credential: Credential = None,
):
"""
获取特殊开屏启动画面
Expand All @@ -67,10 +77,24 @@ async def get_loading_images_special(mobi_app: str = "android", platform: str =
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_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.update(sign_params.encode(encoding="utf-8"))
sign = sign.hexdigest()

params = {
Expand All @@ -80,6 +104,6 @@ async def get_loading_images_special(mobi_app: str = "android", platform: str =
"screen_height": height,
"screen_width": width,
"ts": ts,
"sign": sign
"sign": sign,
}
return await request('GET', api['url'], params, credential=credential)
return await request("GET", api["url"], params, credential=credential)
Loading

0 comments on commit d8293b3

Please sign in to comment.