From 55a04bb1ad66c17bf265fc8237f4c3fc266de540 Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Fri, 16 Jan 2026 06:11:35 +0800 Subject: [PATCH] store job info when response --- packages/sqlite-plugin/src/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/sqlite-plugin/src/index.ts b/packages/sqlite-plugin/src/index.ts index cfb0e92..82c7e20 100644 --- a/packages/sqlite-plugin/src/index.ts +++ b/packages/sqlite-plugin/src/index.ts @@ -97,6 +97,25 @@ export default class SqlitePlugin { userInfo = null apply(hooks) { + hooks.pageGotten.tap( + 'SqlitePlugin', + (page) => { + page.on('response', async (response) => { + const ds = await this.initPromise; + if (response.url().startsWith('https://www.zhipin.com/wapi/zpgeek/job/detail.json')) { + const data = await response.json() + if (data.code === 0) { + await saveJobInfoFromRecommendPage(await ds, data.zpData) + await saveJobHireStatusRecord(await ds, { + encryptJobId: data.zpData.jobInfo.encryptId, + hireStatus: JobHireStatus.HIRING, + lastSeenDate: new Date() + }) + } + } + }) + } + ) hooks.userInfoResponse.tapPromise( "SqlitePlugin", async (userInfoResponse) => {