refactor code about collect job info

This commit is contained in:
geekgeekrun
2026-02-06 05:43:53 +08:00
parent 9fc16106cd
commit eac79a9661
@@ -49,9 +49,8 @@ const attachRequestsListener = async (target: Target) => {
return
}
function handleJobDetailPage({ encryptJobId } = { encryptJobId: null }) {
Promise.resolve()
.then(async () => {
// FIXME: might not work
async function handleJobDetailPage({ encryptJobId } = { encryptJobId: null }) {
if (!encryptJobId) {
return
}
@@ -60,7 +59,8 @@ const attachRequestsListener = async (target: Target) => {
({ encryptJobId }) => {
return (
location.href.startsWith(`https://www.zhipin.com/job_detail/${encryptJobId}`) &&
document.readyState === 'complete'
(!!document.querySelector('#main .job-banner') ||
!!document.documentElement.innerText?.includes(`您访问的页面不存在`))
)
},
undefined,
@@ -105,8 +105,6 @@ const attachRequestsListener = async (target: Target) => {
} catch {
//
}
})
.catch(() => void 0)
}
if (page.url().match(/^https:\/\/www.zhipin.com\/job_detail\/(.+)\.html/)) {
@@ -200,7 +198,7 @@ const attachRequestsListener = async (target: Target) => {
)
const requestBody = new URLSearchParams(response.request().postData())
const securityIdInRequest = requestBody.get("securityId")
const securityIdInRequest = requestBody.get('securityId')
const currentJobSecurityId = currentJobData?.securityId
if (securityIdInRequest !== currentJobSecurityId) {