网站地址

https://guba.eastmoney.com/rank/

请求数据

http://gbcdn.dfcfw.com/rank/popularityList.js?type=0&sort=0&page=1&v=2022_6_28_15_38

视频教程

https://www.bilibili.com/video/BV1NU4y1X7YR/

Python代码

import base64,requests,re,urllib3,hashlib
from Crypto.Cipher import AES

urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

def aesCbcDecode(content,key, iv,pkcs=5):
    try:
        key_bytes = bytes(key, encoding='utf-8')
        iv = bytes(iv, encoding='utf-8')
        cipher = AES.new(key_bytes, AES.MODE_CBC, iv)
        aes_encode_bytes = base64.b64decode(content)
        aes_decode_bytes = cipher.decrypt(aes_encode_bytes)
        result = str(aes_decode_bytes, encoding='utf-8')
        if pkcs==7:
            result = pkcs7unpadding(result)
    except:
        pass
    else:
        return result

def pkcs7unpadding(text):
    try:
        length = len(text)
        unpadding = ord(text[length - 1])
        return text[0:length - unpadding]
    except Exception as e:
        pass

url=f'https://gbcdn.dfcfw.com/rank/popularityList.js?type=0&sort=0&page=1&v=2022_6_28_15_00'
resp=requests.get(url,verify=False)
e=re.search(r"popularityList='(.*?)'",resp.text).group(1)

iv='getClassFromFile'
key=hashlib.md5('getUtilsFromFile'.encode(encoding='UTF-8')).hexdigest()

deResp=aesCbcDecode(e,key,iv,7)
print(deResp)

本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习使用,请在下载后24小时内删除,严禁商用。若由于商用引起版权纠纷,一切责任均由使用者承担。