爬取问财网的今日涨停信息
载荷多试几次可以发现除了页码等信息,都是固定值,因此变化一定是在请求头
可以发现变化的就是HeXin-V的值,并且在cookie中也有对应的键值对,所以下一步就是找到该值生成的位置。
因为Cookie中有这个值,所以可以通过Cookie Hook的方式来定位
(function(){ 'use strict' var _cookie = ""; Object.defineProperty(document, 'cookie', { set: function(val) { console.log(val); debugger _cookie = val; return val; }, get: function() { return _cookie; }, }); })()
在开头直接打断点,然后在控制台运行这个Hook函数,该函数的作用是每当设置Cookie值时,会加断点
找到v值设置的地方,通过调用堆栈找到具体的函数
最后发现生成这个值的地方是这个D()函数,因为生成方式较为复杂,所以直接通过js代码的方式来实现。
两种思路,一种是需要什么找什么,一种是全部代码拿过来,不需要什么删什么。
无论是哪种思路,都要模拟嵌套生成函数所在的层级。
document对象和window对象在这个案例中会用到,但是后台程序执行没有这两个对象,因此做一个简单的补环境
因为需要执行这个函数,所以把他设置成全局的,然后在全局执行
报了这个错误,一般这种错误,可以找到代码对应的位置,打印附近的变量
发现是与document相关的,我们用node来执行程序,没有window对象和document对象,因此涉及到这两个报错的,一般可以删除或者略过
这个也相同,但是不能直接删除,因为涉及到了其他变量,发现in这个关键字,因此可以置为[]
同上可直接删除
一般不是undefined的错误,都有一定的原因
可以发现S对象调用之前,并不知道是在哪声明的
网上找发现S是由P这个函数来声明的,所以在此之前,一定在某个地方执行了P函数
因此可以直接执行一次P函数
这个地方报错,去打断点看一下附近的变量
可以看出这个还是与document有关,是设置Cookie值的,因此直接删除掉这个隔离函数
可以发现,下面有一个random函数,点进去看就是一个随机值,所以上面的一系列操作都可以删除
这一系列值都是和浏览器相关的东西,可以在控制台打印,是固定的值,进行替换
最终获取该值
js代码
var TOKEN_SERVER_TIME = 1721028932.734; // 补环境 --------------------------------------------------------------------------------------- var document={} var window={} // 全局对象 -------------------------------------------------------------------------------------- var target=this !function(n,t){ var r, e, a; r = e = a = n; var u, c, s; u = c = s = t; function v() { var n = arguments[s[0]]; if (!n) return r[0]; for (var t = u[1], o = a[1], i = c[2]; i < n.length; i++) { var v = n.charCodeAt(i) , f = v ^ o; o = v, t += e[2].fromCharCode(f) } return t } var f = c[3] , l = s[4] , p = Wn(e[3], r[4], s[5]) , d = a[5] , h = Wn(c[6], s[7]) , g = c[8] , w = c[9] , m = r[6] , I = u[10] , y = a[7] , _ = (s[11], c[12], s[13]) , C = e[8] , E = u[14] , A = ot(e[9], e[10]) , b = a[11] , T = u[15] , B = c[16] , R = r[12] , k = r[13] , S = s[17] , P = u[18] , M = Wn(s[19], s[20], u[21]) , O = v(s[22], e[14]) , D = s[23] , x = s[24] , N = u[25] , L = u[26] , W = Wn(s[27], r[15]) , F = u[28] , Y = r[16] , j = a[17] , H = e[18] , $ = e[19] , U = r[20] , V = v(c[29], e[21], e[22]) , X = s[30] , G = s[31] , K = s[32] , Q = s[33] , Z = r[23] , q = r[24] , z = v(u[12], u[34], s[35]) , J = u[36] , nn = a[25] , tn = s[37] , rn = c[38] , en = r[26] , an = c[39] , on = s[40] , un = a[27] , cn = u[41] , sn = ot(s[42], c[43]) , vn = r[28] , fn = u[8] , ln = s[44] , pn = a[29] , dn = s[45] , hn = a[30] , gn = c[46] , wn = a[31] , mn = a[32] , In = s[47] , yn = r[33] , _n = a[34] , Cn = c[48] , En = a[8] , An = v(a[35], s[49]) , bn = c[50] , Tn = c[51] , Bn = at(r[36], s[52]) , Rn = ot(r[37], e[38]) , kn = e[39] , Sn = u[53] , Pn = r[40] , Mn = s[54] , On = s[55] , Dn = Wn(u[56], r[41], r[42]) , xn = r[43] , Nn = u[57] , Ln = e[44]; function Wn() { return arguments[u[0]].split(e[0]).reverse().join(c[1]) } var Fn = r[45], Yn = Wn(c[58], e[46]), jn = v(s[59], u[60]), Hn = Wn(r[47], s[61]), $n = s[62], Un = s[63], Vn = u[2], Xn = [new u[27](r[48]), new u[27](c[64])], Gn = [new e[47](ot(a[49])), new u[27](ot(a[50], u[65]))], Kn = c[66][f + l] , Qn; // !function(n) { // n[e[53]] = s[67]; // function t(n) { // var t = r[51][u[68]] // , o = u[69] + n + s[70] // , i = t.indexOf(o); // if (i == -e[54]) { // if (o = n + c[70], // t.substr(r[52], o.length) != o) // return; // i = a[52] // } // var f = i + o[v(u[71], s[72])] // , l = t.indexOf(r[55], f); // return l == -a[54] && (l = t[a[56]]), // t.substring(f, l) // } // n[a[57]] = f; // function o(n, t, a, o, i) { // var c = n + r[58] + t; // o && (c += e[59] + o), // i && (c += v(Jn, u[73], s[74]) + i), // a && (c += u[75] + a), // u[66][u[68]] = c // } // n[s[76]] = t; // function i(n, t, r) { // this.setCookie(n, u[1], u[77], t, r) // } // n[s[78]] = o; // function f() { // var t = a[60]; // this.setCookie(t, u[67]), // this.getCookie(t) || (n[r[53]] = e[61]), // this.delCookie(t) // } // n[Wn(N, r[62], c[79])] = i // }(Qn || (Qn = {})); var Zn; var qn = function() { var n, t, r; n = t = r = a; var e, o, i; e = o = i = s; var u = o[15] , c = o[102] , f = e[103]; function l(r) { var a = o[102] , i = e[103]; this[n[76]] = r; for (var u = t[52], c = r[a + g + i]; u < c; u++) this[u] = t[52] } return l[e[104]][w + m + I + u] = function() { for (var a = e[105], u = this[a + y], c = [], s = -e[0], v = o[2], f = u[r[56]]; v < f; v++) for (var l = this[v], p = u[v], d = s += p; c[d] = l & parseInt(t[77], n[78]), --p != r[52]; ) --d, l >>= parseInt(n[79], i[106]); return c } , l[v(t[80], t[81], b)][ot(i[107])] = function(n) { for (var r = e[8], a = this[ot(e[108], e[109])], o = t[52], u = e[2], s = a[c + r + f]; u < s; u++) { var v = a[u] , l = i[2]; do { l = (l << t[82]) + n[o++] } while (--v > t[52]); this[u] = l >>> i[2] } } , l }(), zn; !function(n) { var t = s[13] , o = c[53] , i = r[83] , f = r[84] , l = s[110] , d = r[85] , h = r[86]; function g(n, a, o, i, u) { for (var c = s[13], v = r[87], f = n[s[111]]; a < f; ) o[i++] = n[a++] ^ u & parseInt(c + v + t + _, r[88]), u = ~(u * parseInt(e[89], e[82])) } function w(n) { for (var t = c[112], i = r[52], v = n[s[111]], f = []; i < v; ) { var l = n[i++] << parseInt(C + t, c[113]) | n[i++] << e[82] | n[i++]; f.push(m.charAt(l >> parseInt(e[90], e[82])), m.charAt(l >> parseInt(s[114], e[78]) & parseInt(a[91], r[88])), m.charAt(l >> u[59] & parseInt(E + o, a[78])), m.charAt(l & parseInt(a[92], u[113]))) } return f.join(e[0]) } for (var m = at(u[115], s[116]), I = {}, y = u[2]; y < parseInt(i + A, e[93]); y++) I[m.charAt(y)] = y; function O(n) { var t, r, e; t = r = e = s; var o, i, u; o = i = u = a; for (var c = ot(i[94]), l = e[2], p = n[o[56]], d = []; l < p; ) { var h = I[n.charAt(l++)] << parseInt(at(t[117]), u[82]) | I[n.charAt(l++)] << parseInt(v(t[118], u[95], e[119]), o[88]) | I[n.charAt(l++)] << t[59] | I[n.charAt(l++)]; d.push(h >> parseInt(e[120], t[106]), h >> parseInt(t[121], r[122]) & parseInt(f + b + c, t[106]), h & parseInt(o[96], u[88])) } return d } function D(n) { var t = O(n); if (rn, p, t[r[52]] != h) return error = T + B + l, void 0; var a = t[c[0]] , o = []; return g(t, +parseInt(e[79], c[122]), o, +u[2], a), x(o) == a ? o : void 0 } function x(n) { var t = o; t = Vn; for (var e = c[2], i = a[52], u = n[c[111]]; i < u; i++) e = (e << s[123]) - e + n[i]; return e & parseInt(s[124], r[88]) } function N(n) { var t = et , r = x(n) , e = [h, r]; return g(n, +a[52], e, +a[88], r), t = P, w(e) } n[e[97]] = w, n[R + k + S] = O, n[u[125]] = N, n[d + P + M] = D }(zn || (zn = {})); var Jn; !function(n) { var t = Fn , o = at(c[126], a[98]) , i = r[99] , f = v(U, u[127]) , l = s[128] , p = ot(a[100]) , d = r[5] , h = r[101] , g = ot(u[129]) , w = s[130] , m = r[102] , C = a[103] , E = e[104]; function A(n) { for (var t = (Tn, I, []), e = r[52]; e < n[c[111]]; e++) t.push(n.charCodeAt(e)); return t } function b() { var n = new e[105]; try { return time = s[52].now(), time / parseInt(c[131], a[88]) >>> c[2] } catch (t) { return time = n.getTime(), time / parseInt(s[121], s[84]) >>> r[52] } } function T(n) { var t = u[8] , o = {} , i = function(n, o) { var i = c[102], f, l, p, d; for (o = o.replace(s[132], u[1]), o = o.substring(u[0], o[e[56]] - c[0]), f = o.split(c[133]), p = c[2]; p < f[i + t + O]; p++) if (l = f[p].split(v(r[106], c[134])), l && !(l[r[56]] < s[122])) { for (d = r[88]; d < l[r[56]]; d++) l[r[54]] = l[r[54]] + r[107] + l[d]; l[s[2]] = new r[47](c[135]).test(l[e[52]]) ? l[a[52]].substring(u[0], l[e[52]][D + x] - c[0]) : l[a[52]], l[r[54]] = new a[47](c[135]).test(l[r[54]]) ? l[e[54]].substring(s[0], l[a[54]][a[56]] - u[0]) : l[s[0]], n[l[c[2]]] = l[e[54]] } return n }; return new r[47](e[108]).test(n) && (o = i(o, n)), o } function B(n) { var t, e, a; t = e = a = c; var u, s, v; if (u = s = v = r, typeof n === ot(s[109], sn) && n[Wn(y, a[136], s[110])]) try { switch (parseInt(n[e[137]])) { case parseInt(a[131], t[122]): break; case parseInt(v[111], s[78]): top[e[138]][v[112]] = n[t[139]]; break; case parseInt(u[113], e[122]): top[o + i + N][e[140]] = n[s[114]]; break; default: break } } catch (f) {} } function R(n, t, r) { var e, a, o; e = a = o = u, q ? n.addEventListener(t, r) : n.attachEvent(a[25] + t, r) } function k() { return Math.random() * parseInt(u[141], r[78]) >>> r[52] } function S(n, t) { var o = en , i = new r[47](e[115],a[116]); o = T; var s = new u[27](v(p, r[117], m)); if (n) { var f = n.match(i); if (f) { var l = f[u[0]]; return t && s.test(l) && (l = l.split(r[118]).pop().split(r[107])[c[2]]), l } } } function P(n) { var t = mn , o = c[142] , i = r[119] , v = e[120] , I = a[121]; if (!(n > e[122])) { n = n || a[52]; var y = parseInt(u[143], e[78]) , _ = a[51].createElement(u[144]); t = Q, _[c[145]] = location[r[123]] + a[124] + parseInt((new r[105]).getTime() / y) + (f + o + l), _[e[125]] = function() { Vn = u[0], setTimeout(function() { P(++n) }, n * parseInt(e[126], u[84])) } , _[p + L + d] = _[s[146]] = function() { var n, t, r; n = t = r = a; var e, o, u; e = o = u = c; var s = e[147]; this[t[127]] && this[i + W] !== o[148] && this[u[149]] !== o[150] && this[s + F + h] !== u[151] || (Vn = n[52], _[e[152]] = _[g + w + v] = n[128]) } , c[66][m + I].appendChild(_) } } function M(n) { var t, e, a; t = e = a = r; var o, i, u; return o = i = u = s, new u[27](t[129]).test(n) } function X() { var n = new s[52]; return typeof TOKEN_SERVER_TIME == s[153] ? r[52] : (time = parseInt(TOKEN_SERVER_TIME), time) } function G(n) { var t, e, a; t = e = a = s; var o, i, u; o = i = u = r; for (var c = u[52], v = a[2], f = n[o[56]]; v < f; v++) c = (c << a[123]) - c + n.charCodeAt(v), c >>>= o[52]; return c } function K(n) { var t = new s[27](e[130],s[80]); if (n) { return n.match(t) } } function Z(n) { var t = new u[27](c[154]); if (M(n)) return n; var o = t.test(n) ? -a[86] : -parseInt(r[79], e[88]); return (tn, _, n.split(s[155])).slice(o).join(a[131]) } n[Y + C + j] = T, t = En, n[c[156]] = P, n[ot(u[157])] = B, n[r[132]] = A, n[c[158]] = G, n[c[159]] = k, n[r[133]] = M, n[s[160]] = Z, n[E + H] = S, n[$ + U] = K, n[s[161]] = z, n[s[162]] = b, n[r[134]] = X; var q = !!a[65][a[135]]; function z(n) { for (var t = v(O, u[163]), a = e[136], o = s[2], i = n[V + t + a] - s[0]; i >= r[52]; i--) o = o << r[54] | +n[i]; return o } n[u[164]] = R }(Jn || (Jn = {})); var nt; var tt; var rt; var et; function at() { var n, t, r; n = t = r = u; var a, o, i; a = o = i = e; var c = arguments[o[52]]; if (!c) return t[1]; for (var s = o[0], v = o[1], f = a[52]; f < c.length; f++) { var l = c.charCodeAt(f) , p = l ^ v; v = v * f % n[222] + o[200], s += i[2].fromCharCode(p) } return s } function ot() { var n, t, e; n = t = e = c; var a, o, i; a = o = i = r; var u = arguments[a[52]]; if (!u) return o[0]; for (var s = a[0], v = n[267], f = o[200], l = t[2]; l < u.length; l++) { var p = u.charCodeAt(l); f = (f + t[0]) % v.length, p ^= v.charCodeAt(f), s += i[2].fromCharCode(p) } return s } var it; var rt; !function(n) { var t = e[87], o = a[8], i = e[8], f = s[215], l = r[52], p = s[0], d = parseInt(c[216], u[122]), h = e[86], g = u[217], w = u[123], m = e[165], I = parseInt(t + En, c[122]), y = parseInt(a[79], a[82]), _ = c[218], C = parseInt(a[193], e[82]), E = parseInt(o + i, r[78]), A = parseInt(u[219], s[122]), b = parseInt(f + An, s[106]), T = parseInt(r[194], s[106]), B = parseInt(ot(s[220], e[195]), r[82]), R = parseInt(e[196], u[122]), k = parseInt(e[197], a[78]), S; function P() { var n = s[0] , t = r[88] , e = parseInt(u[13], c[122]) , a = s[217]; S = new qn([a, a, a, a, n, n, n, e, t, t, t, t, t, t, t, a, t, n]), S[p] = Jn.serverTimeNow(), M(), S[B] = Vn, S[k] = Un, S[R] = c[2], S[h] = "4173916359", S[b] = "3748", S[g] = "1", S[w] = "10", S[m] = "5" } function M() { // var n = Qn.getCookie(Fn) || Zn.get(jn); // if (n && n[s[111]] == parseInt(c[221], e[93])) { // var t = zn.decode(n); // if (t && (S.decodeBuffer(t), // S[l] != s[2])) // return // } //模拟第一次游客登陆 --------------------------------------------------------------------------------------------- S[l] = Jn.random() } function O() { S[R]++, S[p] = Jn.serverTimeNow(), S[d] = Jn.timeNow(), S[B] = Vn, S[I] = "440", S[y] = "1", S[_] = "0", S[C] = "0", S[E] = "1011", S[A] = "25"; var n = S.toBuffer(); return zn.encode(n) } n[e[57]] = P; // --------------------------------------------------------------------------------------------------------------------------------- P() function D() { return O() } target.num = D n[v(an, a[198], r[199])] = D }(rt || (rt = {})); }(["", 9527, String, Boolean, "eh", "ad", "Bu", "ileds", "1", "\b", Array, "7", "base", "64De", "\u2543\u252b", "etatS", "pa", "e", "FromUrl", "getOrigi", "nFromUrl", "\u255b\u253e", "b?\x18q)", "ic", "k", "sted", "he", "wser", "oNo", "ckw", "ent", "hst", "^And", "RM", "systemL", 5, "\u255f\u0978\u095b\u09f5", "TR8", "!'", "gth", "er", "TP", 83, "r", !0, "v", "v-nixeh", RegExp, "thsi.cn", 'K\x19"]K^xVV', "KXxAPD?\x1b[Y", document, 0, "allow", 1, "; ", "length", "Init", "=", "; domain=", "checkcookie", !1, "eikooCled", "tnemucod", "d", window, "\u2553\u0972\u0959\u09e4\u09bd\u0938\u0980\u09c5\u09b1\u09d1\u09a7\u09dc\u09dd\u09d3\u09c2", "\u2556\u0979\u095e\u09d3\u09b5\u0935\u098f\u09c7\u099d\u09d2\u09b0", 23, "l$P$~", "frames", "ducument", "ydob", "documentElement", "del", "@[\\]^`{|}~]", "base_fileds", "255", 10, "10", 39, "\u2547\u2535\u255a\u252e\u2541\u2535\u254c\u253c\u2559", 8, "4", "3", "de", 3, "11", 2, "203", "22", "111111", "3f", 16, "\x0f", "\u2506\u2537\u2507\u2537", "11111111", "base64Encode", "v\x1d", "ati", "WY", "te", "bo", "rs", "getHost", Date, "{DF", ":", "^{.*}$", "WU<P[C", 52, "1001", "href", "1111101010", "redirect_url", "^\\s*(?:https?:)?\\/{2,}([^\\/\\?\\#\\\\]+)", "i", "\u256c\u252c\u2516\u254b", "@", "ready", "change", "dy", 7, "protocol", "//s.thsi.cn/js/chameleon/time.1", "onerror", "2000", "readyState", null, "^(\\d+\\.)+\\d+$", "^\\s*(?:(https?:))?\\/{2,}([^\\/\\?\\#\\\\]+)", ".", "strToBytes", "isIPAddr", "serverTimeNow", "addEventListener", "th", "wh", "Scro", "mousemove", 55, "evomhcuot", "[[?PVC\x0e", "getMouseMove", '_R"xWB%Po_3YT', "getMouseClick", "ght", "gin", "msD", "ack", "\u2556\u096b\u095f", "Nativ", "^A", "MozSettingsEvent", "safari", "ActiveXObject", "postMessage", "Uint8Array", "WeakMap", "Google Inc.", "vendor", "chrome", "python", "sgAppName", "JX", 6, "me", "LBBROWSER", "w4", "2345Explorer", "TheWorld", "\u2544", 40, "tTr", "\u2506", "navigator", "webdriver", "languages", "taborcA|FDP", "\u2541\u097c\u0949", 95, "1e0", "e Cli", "iso-8859-1", "defaultCharset", "localStorage", "^Win64", "^Linux armv|Android", "^iPhone", "^iPad", "B_{VV", "getPluginNum", "getBrowserFeature", "12", "16", "sE", "10000", "17", "\u2542\u2532\u2556\u2537\u2543\u2526", "\x1cx`R", 2333, "XMLH", "ers", "0", "lo", 57, "ylppa", "error", "target", "click", "unload", "HE9AWT9Y", "\\.", "c?", "$", "/", "fetch", "prototype", "url", "\u2556\u0971\u0956\u09fe\u09a7", "headers", "\u256b\u2554", 79, "?", "^(.*?):[ \\t]*([^\\r\\n]*)\\r?$", "gm", "s", "src", "analysisRst", "\u255e\u0973\u0949\u09f4\u09a2\u0929\u09ac\u09d4\u0992\u09d2\u09b0\u09d4", "appendChild", "Y", "jsonp_ignore", "^", 70, "421", "XH>a", "\u2574\u253c\u257d\u2530\u2575\u2539\u257c\u2533\u257d\u2522\u256e\u2521\u2560\u2524\u2561\u2525", "CHAMELEON_LOADED"], [1, "", 0, "he", "ad", 29, "\x180G\x1f", "?>=<;:\\\\/,+", "ng", "to", "ff", Number, Error, "11", "6", "er", "ro", "code", "co", "_?L", "ed", "@S\x15D*", Object, "len", "gth", "on", "lo", RegExp, "ySta", 13, "eel", "ee", "ouse", "ll", "\u2544\u2530\u2555\u2531", "FCm-", "isTru", "getC", "Pos", "ve", "or", "ae", "^", "On", "Sho", "can", "ont", "roid", "anguage", "\u2502", "ta", "tna", Date, "3", "am", "e", "n+", "f80", "\x1dD", 6, "\u255f\u253a\u2542\u252b\u2545\u2568\u251e", "KCABLLAC_NOELEMAHC", "X-Antispider-Message", 3, ".baidu.", Function, document, !0, "cookie", "; ", "=", 96, "\u255b\u253e\u2550\u2537\u2543\u252b", "\u250c\u252c\u255c\u253d\u2549\u2521\u251c", ";O", "; expires=", "getCookie", "Thu, 01 Jan 1970 00:00:00 GMT", "setCookie", "Z\x18|", "i", "\u255b\u2534\u2557\u2536\u255a\u2509\u257d\u2512\u2560\u2501\u2566\u2503", 52, window, 10, "Init", !1, "set", "v", "eliflmth", '<script>document.w=window<\/script><iframe src="/favicon.icon"></iframe>', "iS.p", "head", "#default#userData", "get", "[!\"#$%&'()*", "g", "^d", "$D", "\u2568\u2537\u2568\u254c\u256a", "]\\P", "___", "le", "th", "prototype", "base_f", 8, "\\R5Z\\R\x14@^Q3G", "ZV%PgQ?Y]S%", 67, "r", "length", "0", 16, "12", "\u2576\u095f\u0979\u09d5\u0995\u091b\u09a9\u09f9\u09bd\u09f7\u0989\u09fd\u09f5\u09f3\u09f9\u0a41\u0a4d\u098f\u0999\u0905\u0975\u09cb\u09a9\u09a9\u099d\u0927\u0933\u0913\u0a6b\u0999\u09a3\u0937\u098b\u09f5\u0933\u0a7b\u091b\u09b1\u0a63\u095f\u09fb\u094d\u0993\u0943\u092b\u0949\u09a3\u09e7\u09cb\u0925\u0993\u09ab\u09f0\u092c\u092c\u0942\u0950\u09c8\u0944\u09c6\u0990\u0944\u09cb\u098e", "i,", "\u2505\u092f", 12, 56, "20", "1000", 2, 5, "11111111", "encode", "\u255b\u0972\u0959", "\u2519", "s", "WY$PYS", "ystate", "1111101000", / /g, ",", "\u250d", '^".*"$', "edoc_sutats", "status_code", "location", "redirect_url", "href", "4294967295", "j", "1200000", "script", "src", "onreadystatechange", "read", "loaded", "readyState", "complete", "interactive", "onload", "undefined", "\\.com\\.cn$|\\.com\\.hk$", ".", "getServerTime", 'YY7YAD?FjD"', "strhash", "random", "getRootDomain", "booleanToDecimal", "timeNow", "\u2559\u253e", "eventBind", "onwh", "\u255b", 46, "DOMM", "cl", "T^5^", "div", "onmousewheel", "mousewheel", 51, "keydown", "clientY", "getKeyDown", "ch", "plu", "\u2543\u252b", "ouc", "art", "^i", "Po", "callPhantom", "max", "Hei", "ActiveXObject", "nd", "yG&Y]\x17\x15ZUG#A]Ez\x15qY5\x1b", "\u2576\u097e\u094e\u09f8\u09a6\u0938\u09b6\u09fe\u0996\u09d7\u09a7\u09d2\u09cc", "Maxthon", "Q", "opr", "chrome", "BIDUBrowser", "QQBro", "[_$ZUR", "UBrowser", "MSGesture", "plugins", "doNotTrack", "ShockwaveFlash.ShockwaveFlash", "]C|\x18", "webgl2", "platform", "name", "^Win32", "^MacIntel", "^Linux [ix]\\d+", "^BlackBerry", "language", "getPlatform", "getBrowserIndex", "1", "10", 4, 9, "1100", "\t\0", "3c", 256, "w", "TTP", "et", "c", "al", "\u255e", "base", "\u2569\u0975\u094e\u09e5\u09a0\u092e\u09d1\u09ed\u09ce", "target", "fh%PTQr", "#", "\u255f\u097c\u0949\u09f9", 97, "rg", "tnemelEcrs", "fn_Ws", "parentNode", "tagName", "A", "submit", "PX%", "me", "host", "\\.?", "d\x19", "Fri, 01 Feb 2050 00:00:00 GMT", "]E%", "toString", "[object Request]", "headers", 83, "&", encodeURIComponent, "open", "getAllResponseHeaders", "4", "tseuqeRpttHLMX", "Window", "\u2564\u095e", "RI", "\u2550\u0953", "(YaZ", "_", "_str", "V587"]) console.log(target.num())
Python代码
import json import requests from functools import partial import subprocess subprocess.Popen = partial(subprocess.Popen, encoding="utf-8") import execjs url = "https://music.163.com/weapi/song/enhance/player/url/v1?csrf_token=" headers={ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36", "Cookie":"_ntes_origin_from=baidu; NMTID=00O1BewknX9OrvdWUx7kQCT6cTK11sAAAGQV1NK7g; _ntes_nnid=38ff67cd14bb267d681cf98d3b53e2c5,1719451994914; _ntes_nuid=38ff67cd14bb267d681cf98d3b53e2c5; WEVNSM=1.0.0; WNMCID=caxlvt.1719451995209.01.0; WM_NI=g666XKuwXzvFGgiCF6nqqq9HdQWRQo38yTH84zq6aW8v7QudhqOZArGhIqThkVg4AXWTZCY5GwtgRHr0MAJ7qhIizl7jiw0xuQPsPr2AlCXxsgK5mriDxy%2BglqXlYeL7emY%3D; WM_NIKE=9ca17ae2e6ffcda170e2e6eed8d27392bb96dae27288b88fa7d45e928b8b86d24b9592e5bab340bab597d1f92af0fea7c3b92aa5eafad7db41b7a9989bf54e85b9a7a4c53eaeafbf92bc44a88f99b3d465f1e8b7b5cb34f8a6bfd7e45dfcaaf9b2f870acaf81bbc47a85b88792d764a98aa9d5c454958c96a4dc3f85a9bc88d144b2f083a2c93db3b8878af968f5b6a798b374b78fa094d37af29fa4a4db74b1b985d6f07aab9cb89aaa6db0af988ddc6f90e9ab8edc37e2a3; WM_TID=HPe7Itd%2FDTJAERBQUReDRSI%2BIhtmhZk2; sDeviceId=YD-P35wvxtjE8VBQ1EQEEOAgizRYyVWV2DZ; ntes_utid=tid._.h1gWdlstPMFEFkUUBRfWQHNvI15njExW._.0; _iuqxldmzr_=32; JSESSIONID-WYYY=rxQaCoF2OPajb4tMYpVseIb%5CJXRZU0e7ebOWYPFanAynmZd8wk2FOhW11W%2Fn4Vb%2Fjkrr6HO2cl2S8fgsFZ%5CI1%2F%2BI1whkzZZ4NWYSm4voA1I7p8FE4waKZg1s7g5l3Ez%5C6jgsWzC5R%2FxAxQT3CCstRZN5Fxq8AX9jvMbfYFx7Whbo6iaP%3A1719469671276; playerid=83544972", } # 构建载荷所需参数 music_id = 1347227968 song_info = { "ids":f"[{music_id}]", "level":"standard", "encodeType":"aac", "csrf_token":"" } e='010001' h="00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7" g='0CoJUm6Qyw8W8jud' # js逆向 构建载荷 with open("wangyiyun.js") as f: jscode = f.read() js = execjs.compile(jscode) data = (json.dumps(song_info),e,h,g) res = js.call("jiemi",*data) # 发送请求 获取音频地址 data = { "params": res.get("encText"), "encSecKey": res.get("encSecKey") } response = requests.post(url=url,headers=headers,data=data) res = response.text url = json.loads(res).get("data")[0].get("url") # 请求音频 保存到本地 music = requests.get(url=url) with open("a.m4a","wb") as f: f.write(music.content)
标签:function,return,同花顺,问财,JS,parseInt,var,new,52 From: https://www.cnblogs.com/sxy-blog/p/18307534