Skip to content

Commit

Permalink
规范bv转av(python)示例的类型 (#960)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kataick authored Feb 1, 2024
1 parent 6659958 commit f16cfe9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/misc/bvid_desc.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ BASE = 58
BV_LEN = 12
PREFIX = "BV1"

def av2bv(aid):
def av2bv(aid: int) -> str:
bytes = [b'B', b'V', b'1', b'0', b'0', b'0', b'0', b'0', b'0', b'0', b'0', b'0']
bv_idx = BV_LEN - 1
tmp = (MAX_AID | aid) ^ XOR_CODE
Expand All @@ -173,7 +173,7 @@ def av2bv(aid):
bytes[4], bytes[7] = bytes[7], bytes[4]
return "".join([i.decode() for i in bytes])

def bv2av(bvid: str):
def bv2av(bvid: str) -> int:
bvid = list(bvid)
bvid[3], bvid[9] = bvid[9], bvid[3]
bvid[4], bvid[7] = bvid[7], bvid[4]
Expand Down

0 comments on commit f16cfe9

Please sign in to comment.