CSC portal Playwright scraper + import 16 open government IT vacancies

This commit is contained in:
Jonathan Sykes
2026-08-16 20:56:01 +08:00
parent bcbecbb49a
commit 0cdfc4806c
5 changed files with 102 additions and 0 deletions

20
scripts/csc-scrape.ts Normal file
View File

@@ -0,0 +1,20 @@
import { chromium } from "playwright";
async function main() {
const browser = await chromium.launch({ headless: true });
const ctx = await browser.newContext({
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
viewport: { width: 1366, height: 900 },
});
const page = await ctx.newPage();
const resp = await page.goto("https://csc.gov.ph/career/", { waitUntil: "domcontentloaded", timeout: 60000 });
console.log("status:", resp?.status());
await page.waitForTimeout(8000); // let any JS/Cloudflare settle
console.log("title:", await page.title());
const text = (await page.innerText("body").catch(() => "")).slice(0, 1500);
console.log("---body preview---");
console.log(text);
await page.screenshot({ path: "/tmp/claude-1000/-home-josh-development-personal-tasks/c55d38eb-c0a2-4a78-b5c5-78f6d6ca1fa6/scratchpad/csc.png", fullPage: false });
await browser.close();
}
main().catch((e) => { console.error(e); process.exit(1); });