Last active
August 31, 2024 01:43
-
-
Save abc1763613206/b8afbb88849835f064f74e652fdb16c5 to your computer and use it in GitHub Desktop.
BVID Validate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import random | |
Back_URL = 'https://api.bilibili.com/x/web-interface/archive/stat?aid=' | |
headers = { | |
'Cookie': "Replace Me With REAL COOKIE" , | |
'Pragma': 'no-cache', | |
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36' | |
} | |
table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF' | |
tr={} | |
for i in range(58): | |
tr[table[i]]=i | |
s=[11,10,3,8,4,6] | |
xor=177451812 | |
add=8728348608 | |
def dec(x): | |
r=0 | |
for i in range(6): | |
r+=tr[x[s[i]]]*58**i | |
return (r-add)^xor | |
def enc(x): | |
x=(x^xor)+add | |
r=list('BV1 4 1 7 ') | |
for i in range(6): | |
r[s[i]]=table[x//58**i%58] | |
return ''.join(r) | |
def checkv(x,y): | |
if str(enc(int(x))) == str(y): | |
return "Vaild √" | |
else: | |
return "Not Vaild ×" | |
for i in range(0,50000): | |
n = random.randint(100,9999999) | |
resp = requests.get(Back_URL+str(n),headers=headers) | |
#print(resp.text) | |
res = json.loads(resp.text) | |
if int(res["code"]==0): | |
print("{} {} {}".format(res["data"]["aid"],res["data"]["bvid"],str(checkv(res["data"]["aid"],res["data"]["bvid"])))) |
溜了溜了
溜了溜了
溜了溜了
溜了溜了
留个爪印
留个爪印
怎么感觉你有些眼熟???
留个爪印
怎么感觉你有些眼熟???
aha 被发现了
valid是不是打错成vaild了……
没人?
围观
举个爪
溜了溜了~
溜了溜了
溜了溜了
吃瓜
溜了溜了
溜了溜了
溜了溜了
tql
留名
溜了溜了
复制了下代码到js里面.
才知道python的运算符优先级 ** 比 //高
Math.floor(x / Math.pow(58, i)) % 58
溜了溜了
这个转换方法似乎对一些比较新的视频失效了,可能是中间哪里位数不够。
比如av1650838668实际对应BV1Sj421D7q6,但是enc(1650838668)
结果是'BV1sc4C1N7Ya'
,dec('BV1Sj421D7q6')
结果是-496644980
.
编辑:
找到另一个repo里的算法是可用的:Prcuvu/bilibili-aid-bvid-converter。不过他因为写的是Win32程序,读起来略繁琐。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
围观,竟然没有评论~
溜了溜了