feat: flush jobs to queue per-page — no data loss on crash; live progress output
This commit is contained in:
@@ -19,7 +19,7 @@ export async function verifyLogin(page) {
|
||||
return page.url().includes('/feed');
|
||||
}
|
||||
|
||||
export async function searchLinkedIn(page, search) {
|
||||
export async function searchLinkedIn(page, search, { onPage } = {}) {
|
||||
const jobs = [];
|
||||
|
||||
for (const keyword of search.keywords) {
|
||||
@@ -69,6 +69,7 @@ export async function searchLinkedIn(page, search) {
|
||||
}, { track: search.track, excludes: search.exclude_keywords || [] });
|
||||
|
||||
jobs.push(...found);
|
||||
if (found.length > 0 && onPage) onPage(found);
|
||||
|
||||
// Click next page button
|
||||
const nextBtn = await page.$('button[aria-label="View next page"]');
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function verifyLogin(page) {
|
||||
return loggedIn;
|
||||
}
|
||||
|
||||
export async function searchWellfound(page, search) {
|
||||
export async function searchWellfound(page, search, { onPage } = {}) {
|
||||
const jobs = [];
|
||||
|
||||
for (const keyword of search.keywords) {
|
||||
@@ -77,6 +77,7 @@ export async function searchWellfound(page, search) {
|
||||
}, { track: search.track, excludes: search.exclude_keywords || [], maxResults: SEARCH_RESULTS_MAX });
|
||||
|
||||
jobs.push(...found);
|
||||
if (found.length > 0 && onPage) onPage(found);
|
||||
}
|
||||
|
||||
// Dedupe by URL
|
||||
|
||||
Reference in New Issue
Block a user