Skip to content

The job search that runs on your machine. AI job application framework built on Claude Code: evaluate postings, tailor CVs, write cover letters, prep interviews. Fork it and own it.

fix(jobdanmark): narrow soft-404 detection to avoid rejecting real postings (#206)

Oscar Madera78281e8bea07
diff --git a/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts b/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts
index 5a437ebf..222889bb 100644
--- a/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts
+++ b/.agents/skills/jobdanmark-search/cli/src/commands/detail.ts
@@ -134,7 +134,14 @@ function overviewValue(root: ReturnType<typeof parse>, label: string): string |
function fromRenderedHtml(root: ReturnType<typeof parse>, slug: string, url: string): DetailResult {
const pageTitle = cleanText(root.querySelector("title")?.text ?? "")
- if (pageTitle.toLowerCase().includes("404") || root.text.toLowerCase().includes("siden blev ikke fundet")) {
+ const titleLower = pageTitle.toLowerCase()
+ const bodyText = root.text.toLowerCase()
+ if (
+ bodyText.includes("siden blev ikke fundet") ||
+ titleLower.startsWith("404") ||
+ titleLower.includes("page not found") ||
+ titleLower.includes("siden blev ikke fundet")
+ ) {
throw new Error("NOT_FOUND")
}
diff --git a/.agents/skills/jobdanmark-search/cli/tests/detail-parsing.test.ts b/.agents/skills/jobdanmark-search/cli/tests/detail-parsing.test.ts
index e54bacbc..ed8f4531 100644
--- a/.agents/skills/jobdanmark-search/cli/tests/detail-parsing.test.ts
+++ b/.agents/skills/jobdanmark-search/cli/tests/detail-parsing.test.ts
@@ -49,4 +49,23 @@ describe("parseJobPostingFromHtml", () => {
expect(parsed.description).toContain("identificere relevante datasæt");
expect(parsed.applyUrl).toBe("https://jfm.career.emply.com/da/apply/example");
});
+
+ test("does not reject titles containing '404' mid-phrase", () => {
+ const htmlWith404InTitle = HTML_WITHOUT_JSON_LD.replace(
+ "<title>Journalistisk udvikler s&#xF8;ges | jobdanmark</title>",
+ "<title>HTTP 404 Page Designer | jobdanmark</title>",
+ ).replace(
+ '<h3 class="title">Journalistisk udvikler s&#xF8;ges</h3>',
+ '<h3 class="title">HTTP 404 Page Designer</h3>',
+ );
+
+ const parsed = parseJobPostingFromHtml(
+ htmlWith404InTitle,
+ "http-404-designer",
+ "https://jobdanmark.dk/job/http-404-designer",
+ );
+
+ expect(parsed.title).toBe("HTTP 404 Page Designer");
+ expect(parsed.hiringOrganization.name).toBe("JFM");
+ });
});