一、【逆向】一页15还加密。
二、【自动化】一共获取6600多公司信息
三、对于两种方式我喜欢第二种自动化
from DrissionPage import ChromiumPage, ChromiumOptions import time # chrome:version co = ChromiumOptions().set_paths(browser_path=r"C:\Users\lenovo\AppData\Local\Google\Chrome\Application\chrome.exe") page = ChromiumPage(co) page.get("https://www.kanzhun.com/search/?query=%E5%85%AC%E5%8F%B8&type=0") page.ele('x://div[@class="btn-link"]').click() time.sleep(1) result = [] times = 0 i=0 for j in range(50): print(f"已滑动{i}次了") page.run_js('setInterval(function(){window.scrollBy(0,100)},100)') i+=1 len_result = len(result) print(f"公司总数为{len_result}") for tag in page.eles('x://div[@class="list-item"]',timeout=5): title = tag.ele('x://div[@class="middle"]/a').text dec = tag.ele('x://div[@class="middle"]/div[@class="desc"]').text business_info=tag.ele('x://div[@class="business-info"]').text url= tag.ele('x://a[@class="title"]').attr('href') print(title,dec,business_info,url) result.append(url) newlen_result = len(result) if newlen_result==len_result: times += 1 else: times=0 if times>5: print("已加载完毕") break
四、【逆向】一页15还加密。
1.通过断点调试获得B KIV参数
const fs = require('./js2.js') const CryptoJS = require('crypto-js') window = global; var zy; !function(i) { "use strict"; var e, t, n, r, o, i = {}, u = {}; function c(e) { var t = u[e]; if (void 0 !== t) return t.exports; var n = u[e] = { id: e, loaded: !1, exports: {} }; return i[e].call(n.exports, n, n.exports, c), n.loaded = !0, n.exports } zy = c c.m = i, c.amdO = {}, e = [], c.O = function(t, n, r, o) { if (!n) { var i = 1 / 0; for (l = 0; l < e.length; l++) { n = e[l][0], r = e[l][1], o = e[l][2]; for (var u = !0, f = 0; f < n.length; f++) (!1 & o || i >= o) && Object.keys(c.O).every((function(e) { return c.O[e](n[f]) } )) ? n.splice(f--, 1) : (u = !1, o < i && (i = o)); if (u) { e.splice(l--, 1); var a = r(); void 0 !== a && (t = a) } } return t } o = o || 0; for (var l = e.length; l > 0 && e[l - 1][2] > o; l--) e[l] = e[l - 1]; e[l] = [n, r, o] } , c.n = function(e) { var t = e && e.__esModule ? function() { return e.default } : function() { return e } ; return c.d(t, { a: t }), t } , n = Object.getPrototypeOf ? function(e) { return Object.getPrototypeOf(e) } : function(e) { return e.__proto__ } , c.t = function(e, r) { if (1 & r && (e = this(e)), 8 & r) return e; if ("object" == typeof e && e) { if (4 & r && e.__esModule) return e; if (16 & r && "function" == typeof e.then) return e } var o = Object.create(null); c.r(o); var i = {}; t = t || [null, n({}), n([]), n(n)]; for (var u = 2 & r && e; "object" == typeof u && !~t.indexOf(u); u = n(u)) Object.getOwnPropertyNames(u).forEach((function(t) { i[t] = function() { return e[t] } } )); return i.default = function() { return e } , c.d(o, i), o } , c.d = function(e, t) { for (var n in t) c.o(t, n) && !c.o(e, n) && Object.defineProperty(e, n, { enumerable: !0, get: t[n] }) } , c.f = {}, c.e = function(e) { return Promise.all(Object.keys(c.f).reduce((function(t, n) { return c.f[n](e, t), t } ), [])) } , c.u = function(e) { return "js/" + { 189: "wangeditor", 536: "vod-js-sdk-v6" }[e] + "-" + { 189: "5e0d5d", 536: "a04632" }[e] + ".js" } , c.miniCssF = function(e) {} , c.g = function() { if ("object" == typeof globalThis) return globalThis; try { return this || new Function("return this")() } catch (e) { if ("object" == typeof window) return window } }(), c.o = function(e, t) { return Object.prototype.hasOwnProperty.call(e, t) } , r = {}, o = "kz-ssr-pc:", c.l = function(e, t, n, i) { if (r[e]) r[e].push(t); else { var u, f; if (void 0 !== n) for (var a = document.getElementsByTagName("script"), l = 0; l < a.length; l++) { var s = a[l]; if (s.getAttribute("src") == e || s.getAttribute("data-webpack") == o + n) { u = s; break } } u || (f = !0, (u = document.createElement("script")).charset = "utf-8", u.timeout = 120, c.nc && u.setAttribute("nonce", c.nc), u.setAttribute("data-webpack", o + n), u.src = e), r[e] = [t]; var d = function(t, n) { u.onerror = u.onload = null, clearTimeout(p); var o = r[e]; if (delete r[e], u.parentNode && u.parentNode.removeChild(u), o && o.forEach((function(e) { return e(n) } )), t) return t(n) } , p = setTimeout(d.bind(null, void 0, { type: "timeout", target: u }), 12e4); u.onerror = d.bind(null, u.onerror), u.onload = d.bind(null, u.onload), f && document.head.appendChild(u) } } , c.r = function(e) { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", {