Ship a Camoufox-backed Google Jobs source, restore Glassdoor results discarded by a python-jobspy GraphQL quirk, and fix Himalayas/Gradcracker zero-job failures. Also harden prior-skip dismiss matching and multi-profile basic-auth switching for CA/US runs.
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import type {
|
|
ExtractorManifest,
|
|
ExtractorRunResult,
|
|
} from "@shared/types/extractors";
|
|
import { runGoogleJobs } from "./src/run.js";
|
|
|
|
export const manifest: ExtractorManifest = {
|
|
id: "google-jobs",
|
|
displayName: "Google Jobs",
|
|
providesSources: ["google-jobs"],
|
|
async run(context): Promise<ExtractorRunResult> {
|
|
if (context.shouldCancel?.()) return { success: true, jobs: [] };
|
|
|
|
const parsedMax = context.settings.googleJobsMaxJobsPerTerm
|
|
? Number.parseInt(context.settings.googleJobsMaxJobsPerTerm, 10)
|
|
: Number.NaN;
|
|
const maxJobs = Number.isFinite(parsedMax) ? Math.max(1, parsedMax) : 30;
|
|
|
|
context.onProgress?.({
|
|
phase: "list",
|
|
termsProcessed: 0,
|
|
termsTotal: context.searchTerms.length || 1,
|
|
currentUrl: "https://www.google.com/search?udm=8",
|
|
detail: "Google Jobs: launching browser scrape",
|
|
});
|
|
|
|
const result = await runGoogleJobs({
|
|
searchTerms: context.searchTerms,
|
|
maxJobs,
|
|
});
|
|
|
|
if (!result.success) {
|
|
return { success: false, jobs: [], error: result.error };
|
|
}
|
|
|
|
context.onProgress?.({
|
|
phase: "list",
|
|
termsProcessed: context.searchTerms.length || 1,
|
|
termsTotal: context.searchTerms.length || 1,
|
|
currentUrl: "https://www.google.com/search?udm=8",
|
|
jobPagesProcessed: result.jobs.length,
|
|
detail: `Google Jobs: ${result.jobs.length} jobs`,
|
|
});
|
|
|
|
return { success: true, jobs: result.jobs };
|
|
},
|
|
};
|
|
|
|
export default manifest;
|