侧边栏壁纸
  • 累计撰写 5 篇文章
  • 累计创建 1 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

贴吧参数x-ma-web-access-token和x-bd-logid

WhiteSev
2024-12-25 / 0 评论 / 0 点赞 / 20 阅读 / 0 字

x-ma-web-access-token

其中参数appKeyyhttps://byokpg.smartapps.baidu.com/ 获取

y参数是aData

/**
 * 生成x-ma-web-access-token
 * @param appKey
 * @param y {c: "e", i: 5, t: "Zmx..."}
 */
function generateX_Ma_Web_Access_Token(appKey, y) {
	var _swanWebGlobal = {
		appKey: appKey,
	};

	var a_env = function () {
		return {
			i: {
				a: function () {
					return y;
				},
			},
			r: {
				a: function (e) {
					return String["from" + String.fromCharCode(67) + "harCode"](e);
				},
			},
			o: {
				a: function (e) {
					return (
						!Object.assign(
							{
								backgroundColor: "#fff",
								backgroundTextStyle: "dark",
								backgroundColorTop: "#fff",
								backgroundColorBottom: "#fff",
								enablePullDownRefresh: !1,
								onReachBottomDistance: 50,
							},
							{}
						).enablePullDownRefresh && e
					);
				},
			},
			a: {
				a: function (e) {
					return (function (e) {
						return decodeURIComponent(
							atob(e)
								.split("")
								.map(
									(e) => "%" + ("00" + e.charCodeAt(0).toString(16)).slice(-2)
								)
								.join("")
						);
					})(
						e
							.replace("-", "+")
							.replace("_", "/")
							.padEnd(e.length + ((4 - (e.length % 4)) % 4), "=")
					);
				},
			},
		};
	};

	var env = function () {
		return {
			a: {
				a: function (e) {
					var { i, r, o, a } = a_env();
					var t = Object(i.a)()[Object(r.a)(116)],
						n = Object(o.a)(Object(a.a)(t)).split("_")[1] - e;
					return Math.abs(n) > 5 ? n : 0;
				},
			},
			c: {
				a: function () {
					return y;
				},
			},
			r: {
				a: function (e) {
					return String["from" + String.fromCharCode(67) + "harCode"](e);
				},
			},
			s: {
				s: function (e) {
					return parseInt(Math.random() * e, 10) + 1;
				},
			},
			o: a_env().o,
			l: {
				l: function () {
					var r = null;
					var T = {
						b: function () {
							return _swanWebGlobal || {};
						},
					};
					return r || (r = Object(T.b)().appKey || ""), r;
				},
			},
			i: {
				b: function (e) {
					return (function (e) {
						return btoa(
							encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, (e) =>
								String.fromCharCode("0x" + e)
							)
						);
					})(e)
						.split("=")[0]
						.replace("+", "-")
						.replace("/", "_");
				},
			},
		};
	};

	function h() {
		function f(e, t, n) {
			return e.slice(0, t) + n + e.slice(t);
		}
		var d = "";
		var { a, c, r, s, o, l, i } = env();
		var p = parseInt(new Date().getTime() / 1e3, 10);
		var e = Object(a.a)(p),
			t = Object(c.a)()[Object(r.a)(105)],
			n = Object(c.a)()[Object(r.a)(99)],
			h = Object(s.s)(25),
			g = h.toString(2),
			m = Object(o.a)(Object(l.l)().split("_")[0]),
			v = parseInt(new Date().getTime() / 1e3, 10) + e,
			b = "";
		return v - d <= 5
			? u
			: ((b = Object(i.b)("".concat(m, "_").concat(v, "_").concat(g))),
			  (d = v),
			  (b = f(b, t, n)),
			  (u = f(b, b.length - t, Object(r.a)(97 + h))));
	}
	return h();
}

x-bd-logid

function generate_x_bd_logid() {
	return (function w(e) {
		return ""
			.concat(
				((t = 100),
				(n = 999),
				(a = n - t),
				(r = Math.random()),
				t + Math.round(r * a))
			)
			.concat(Date.now().toString().slice(6));
		var t, n, a, r;
	})();
}

0

评论区