import base64, zlib, time # # #加密 压缩 # base64.b64encode() # zlib.compress() # #解密 解压 # base64.b64decode() # zlib.decompress() # 加密token # 时间戳 *1000 ts = int(time.time()*1000) # 时间戳 *1000-600 cts = int(time.time()*1000)-600 ip = "http://www.dianping.com/shop/3500059" tokens = str({"rId":'100041',"ver":"1.0.6","ts":ts,"cts":cts,"brVD":[1920,186],"brR":[[1920,1080],[1920,1040],24,24],"bI":[ip,"http://www.dianping.com/guangzhou/ch10/r1959"],"mT":["1244,588"],"kT":[],"aT":[],"tT":[],"aM":"","sign":"eJxTKs7IL/BMsTU2NTAwMLVUAgApvgRP"}).encode() _token = zlib.compress(tokens) toeknss = base64.b64encode(_token).decode() print(toeknss) # 解密token a = "eJxVj08LgkAQxb/LnBd3VndLvRldrIwI9RIdrGSV8A+uaBB992YhD8HAvPnNezDzhiF+QCgQUQoGUzlACMJBZwUMRkMbpQIh1p7wV4gM7v8s8BSD25BvIbyIwEVGtqslZwI/gj5e2aIlaVdSWVdMJqjGsQ85n+fZedRF29etdu5dw03V9dxTdJgK6BagQJPagHClZMr3LXlaQr349XGZE3qDUqbWLaly90r3Zh0f+CYxaeYe02hODnkW6aif9PkEny/sa0Tt".encode() bb = base64.b64decode(a) bb = zlib.decompress(bb).decode() print(bb)
我就做个记录