美团token算法流程【2019/3/14】

原创
2019/03/14 11:48
阅读数 2.4K
https://as.meituan.com/meishi/api/poi/getPoiList?cityName=鞍山&cateId=0&areaId=0&sort=&dinnerCountAttrId=&page=3&userId=&uuid=d64fbcc5fc7f4f0ea2f8.1552272373.1.0.0&platform=1&partner=126&originUrl=https://as.meituan.com/meishi/pn3/&riskLevel=1&optimusCode=1



var URL = "cityName=鞍山&cateId=0&areaId=0&sort=&dinnerCountAttrId=&page=4&userId=&uuid=d64fbcc5fc7f4f0ea2f8.1552272373.1.0.0&platform=1&partner=126&originUrl=https://as.meituan.com/meishi/pn4/&riskLevel=1&optimusCode=1"

var iC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
            var iF = function(iG) {
                return iC.charAt(iG)
            };
 var iD = (function(cC) {
                var iH = [];
                var dY = 0;
                var bs = cC.length;
                var dG = 0;
                for (var cs = 0; cs < bs; ++cs) {
                    dY += 1;
                    if (dY === 3) {
                        dY = 0
                    }
                    ;dG = iE(cC, cs);
                    if (dY === 0) {
                        iH.push(iF(((iE(cC, cs - 1) << 2) | (dG >> 6)) & 0x3F), iF(dG & 0x3F))
                    } else {
                        if (dY === 1) {
                            iH.push(iF((dG >> 2) & 0x3F))
                        } else {
                            iH.push(iF(((iE(cC, cs - 1) << 4) | (dG >> 4)) & 0x3F))
                        }
                    }
                    ;if (cs === bs - 1 && dY > 0) {
                        iH.push(iF((dG << ((3 - dY) << 1)) & 0x3F))
                    }
                }
                ;if (dY) {
                    while (dY < 3) {
                        dY += 1;
                        iH.push("=")
                    }
                }
                ;return iH.join("")
            });

var iI = function(jc) {
                    jc = GZIP(JSON.stringify(jc));
                    jc = iD(jc);
                    return jc
                };


步骤就是

var url = "areaId=0&cateId=0&cityName=鞍山&dinnerCountAttrId=&optimusCode=1&originUrl=https://as.meituan.com/meishi/pn4/&page=4&partner=126&platform=1&riskLevel=1&sort=&userId=&uuid=d64fbcc5fc7f4f0ea2f8.1552272373.1.0.0";

token = iI(jx);
cts = new Date().getTime();

> 把这两个参数拼到url就好了
展开阅读全文
JX
打赏
1
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
1
分享
返回顶部
顶部