bs_url = "aHR0cHM6Ly9hY2NvdW50LnhpYW9taS5jb20v"
url = base64.b64decode(bs_url).decode()
print(url)
# 通过对参数的分析发现 ,_sign user hash 参数为加密参数
header = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
}
resp = requests.get(url=url, headers=header)
# print(resp.history[1])
location_url = resp.history[1].headers["Location"]
print(location_url)
urlparse = urllib.parse.urlparse(location_url)
print(urlparse)
query_dict = urllib.parse.parse_qs(urlparse.query)
print(query_dict)
结果:
https://account.xiaomi.com/
https://account.xiaomi.com/fe/service/login?_group=DEFAULT&sid=passport&qs=%253Fcallback%253Dhttps%25253A%25252F%25252Faccount.xiaomi.com%25252Fsts%25253Fsign%25253DZvAtJIzsDsFe60LdaPa76nNNP58%2525253D%252526followup%25253Dhttps%2525253A%2525252F%2525252Faccount.xiaomi.com%2525252Fpass%2525252Fauth%2525252Fsecurity%2525252Fhome%252526sid%25253Dpassport%2526sid%253Dpassport%2526_group%253DDEFAULT&callback=https%3A%2F%2Faccount.xiaomi.com%2Fsts%3Fsign%3DZvAtJIzsDsFe60LdaPa76nNNP58%253D%26followup%3Dhttps%253A%252F%252Faccount.xiaomi.com%252Fpass%252Fauth%252Fsecurity%252Fhome%26sid%3Dpassport&_sign=2%26V1_passport%26BUcblfwZ4tX84axhVUaw8t6yi2E%3D&serviceParam=%7B%22checkSafePhone%22%3Afalse%2C%22checkSafeAddress%22%3Afalse%2C%22lsrp_score%22%3A0.0%7D&showActiveX=false&theme=&needTheme=false&bizDeviceType=
ParseResult(scheme='https', netloc='account.xiaomi.com', path='/fe/service/login', params='', query='_group=DEFAULT&sid=passport&qs=%253Fcallback%253Dhttps%25253A%25252F%25252Faccount.xiaomi.com%25252Fsts%25253Fsign%25253DZvAtJIzsDsFe60LdaPa76nNNP58%2525253D%252526followup%25253Dhttps%2525253A%2525252F%2525252Faccount.xiaomi.com%2525252Fpass%2525252Fauth%2525252Fsecurity%2525252Fhome%252526sid%25253Dpassport%2526sid%253Dpassport%2526_group%253DDEFAULT&callback=https%3A%2F%2Faccount.xiaomi.com%2Fsts%3Fsign%3DZvAtJIzsDsFe60LdaPa76nNNP58%253D%26followup%3Dhttps%253A%252F%252Faccount.xiaomi.com%252Fpass%252Fauth%252Fsecurity%252Fhome%26sid%3Dpassport&_sign=2%26V1_passport%26BUcblfwZ4tX84axhVUaw8t6yi2E%3D&serviceParam=%7B%22checkSafePhone%22%3Afalse%2C%22checkSafeAddress%22%3Afalse%2C%22lsrp_score%22%3A0.0%7D&showActiveX=false&theme=&needTheme=false&bizDeviceType=', fragment='')
{'_group': ['DEFAULT'], 'sid': ['passport'], 'qs': ['%3Fcallback%3Dhttps%253A%252F%252Faccount.xiaomi.com%252Fsts%253Fsign%253DZvAtJIzsDsFe60LdaPa76nNNP58%25253D%2526followup%253Dhttps%25253A%25252F%25252Faccount.xiaomi.com%25252Fpass%25252Fauth%25252Fsecurity%25252Fhome%2526sid%253Dpassport%26sid%3Dpassport%26_group%3DDEFAULT'], 'callback': ['https://account.xiaomi.com/sts?sign=ZvAtJIzsDsFe60LdaPa76nNNP58%3D&followup=https%3A%2F%2Faccount.xiaomi.com%2Fpass%2Fauth%2Fsecurity%2Fhome&sid=passport'], '_sign': ['2&V1_passport&BUcblfwZ4tX84axhVUaw8t6yi2E='], 'serviceParam': ['{"checkSafePhone":false,"checkSafeAddress":false,"lsrp_score":0.0}'], 'showActiveX': ['false'], 'needTheme': ['false']}
标签:false,url,22%,xiaomi,sign,如何,解析,com%
From: https://www.cnblogs.com/pdxt666/p/16791982.html