Auto-deploy: 2026-08-05 17:41:16

This commit is contained in:
Hamza-Ayed
2026-08-05 17:41:16 +03:00
parent ccdbd29770
commit 380f3e4811
3 changed files with 66 additions and 19 deletions
+28 -3
View File
@@ -520,9 +520,34 @@ PROMPT;
if ($pageCount <= $TARGET_PAGES) break;
}
// ATS parsers key on the filename too — "Name - Role.pdf" reads cleanly.
$safeName = preg_replace('/[^a-zA-Z0-9\-_ ]/', '', $id['fullName']);
$safeTitle = preg_replace('/[^a-zA-Z0-9\-_ ]/', '', $jobTitle ?: 'CV');
// ATS parsers key on the filename too — "Name - Role.pdf" reads cleanly,
// and a recruiter sees it before opening anything.
//
// Scraping a job title out of LinkedIn's DOM is fragile, and a bad
// scrape has shipped filenames like "Hamza Ayed - 0 notifications.pdf"
// and "Hamza Ayed - Are these results helpful.pdf". The client is fixed,
// but the server must not depend on the client being right: reject
// anything that does not look like a job title and fall back to the
// profile's own positioning instead.
$rawTitle = trim($jobTitle);
$looksLikeUiText = preg_match(
'/helpful|result|feedback|notification|message|your profile|match|tips|about the job|^\d/i',
$rawTitle
);
// Real job titles carry a role noun. Requiring one rejects stray UI
// strings without hardcoding a list of every possible title.
$hasRoleNoun = preg_match(
'/engineer|developer|architect|lead|manager|consultant|specialist|analyst|designer|' .
'programmer|scientist|director|head of|principal|staff|senior|founding|cto|technologist/i',
$rawTitle
);
if ($rawTitle === '' || $looksLikeUiText || !$hasRoleNoun) {
$rawTitle = $id['primaryTitle'];
}
$safeName = preg_replace('/[^\p{L}0-9\-_ ]/u', '', $id['fullName']);
$safeTitle = preg_replace('/[^\p{L}0-9\-_ ()\/]/u', '', $rawTitle);
$safeTitle = trim(preg_replace('/\s+/', ' ', $safeTitle));
$fileName = trim("{$safeName} - {$safeTitle}") . '.pdf';
+1 -1
View File
File diff suppressed because one or more lines are too long