美文网首页
某科大学排行 参数authorization

某科大学排行 参数authorization

作者: 周周周__ | 来源:发表于2023-03-17 20:57 被阅读0次

    链接: aHR0cHM6Ly93d3cuc2hhbmdoYWlyYW5raW5nLmNvbS8=
    没有过程 直接源码

    def get_authorization(api, method="get", o="67611e7d-9144-4893-a737-0ca577012646", d=""):
      ji = -(random.randint(1000, 2000))
      f = method.upper() + " " + api + " " + d
      m = f"{ji + int(time.time() * 1000)}"
      v = "3#" + o + "#" + f + "#" + m
      hash_obj = hashlib.sha256(v.encode())
      hash_hex = hash_obj.hexdigest()
      x = "3:" + hash_hex + ":" + m
      return base64.b64encode(x.encode()).decode()
    

    这个网站比较有意思的是 数据在js文件中,正则抽取太麻烦,,直接运行js,比较取巧的方法。

    all_data = re.compile('(\(function.*)\)'
    def parse(res_text):
        '''
        解析某些数据在js文件中,通过补充js文件运行调用出来
        :param res_text:
        :return:
        '''
        res = all_data.findall(res_text)[0]
        res = f"my_data={res}" + ";get_my_data=function (){return JSON.stringify(my_data)}"
        ctx = MiniRacer()
        ctx.eval(res)
        data = ctx.call("get_my_data")
        data = json.loads(data)
        return data
    
    

    相关文章

      网友评论

          本文标题:某科大学排行 参数authorization

          本文链接:https://www.haomeiwen.com/subject/guojrdtx.html