Back to Home
Gistify Snippet
Public
Scraper jobstreet
Scraper jobstreet
#github-gist#javascript#gist:09c770e1e6bbd23d9b1eb0643da95aeb#gistsync:2026-09-02T12:40:28Z
2
Rawjobstreet.jsjavascript
95 lines| 1 | |
| 2 | |
| 3 | import * as __ns_180 from 'axios' |
| 4 | const axios = __ns_180.default |
| 5 | import * as __ns_181 from 'node:url' |
| 6 | const pathToFileURL = __ns_181.pathToFileURL |
| 7 | |
| 8 | async function jobstreetSearch(job = "developer", city = "Indonesia", page = 1) { |
| 9 | const keywords = String(job || "").trim() || "developer"; |
| 10 | const where = String(city || "").trim() || "Indonesia"; |
| 11 | const pageNum = Math.max(1, Number(page) || 1); |
| 12 | |
| 13 | try { |
| 14 | const { data } = await axios.get("https://jobsearch-api.cloud.seek.com.au/v5/search", { |
| 15 | params: { |
| 16 | keywords, |
| 17 | where, |
| 18 | sitekey: "ID", |
| 19 | sourcesystem: "houston", |
| 20 | pageSize: 10, |
| 21 | page: pageNum, |
| 22 | locale: "en-US" |
| 23 | }, |
| 24 | headers: { |
| 25 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36", |
| 26 | "Accept": "application/json" |
| 27 | }, |
| 28 | timeout: 15000 |
| 29 | }); |
| 30 | |
| 31 | const jobs = data.data || []; |
| 32 | |
| 33 | return jobs.map(j => ({ |
| 34 | id: j.id, |
| 35 | title: j.title, |
| 36 | company: j.companyName || j.advertiser?.description || "Anonymous", |
| 37 | location: j.locations?.[0]?.label || where || "Indonesia", |
| 38 | salary: j.salaryLabel || "Negotiable", |
| 39 | posted: j.listingDateDisplay || "Recently", |
| 40 | type: j.workTypes?.[0] || "Full Time", |
| 41 | arrangement: j.workArrangements?.displayText || "On-site", |
| 42 | description: j.teaser || "", |
| 43 | url: `https://id.jobstreet.com/job/${j.id}`, |
| 44 | logo: j.branding?.serpLogoUrl || null |
| 45 | })); |
| 46 | } catch (error) { |
| 47 | throw new Error(`Gagal mencari lowongan kerja di JobStreet: ${error.message}`); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | const __dflt_1 = { |
| 52 | jobstreetSearch |
| 53 | }; |
| 54 | |
| 55 | if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { |
| 56 | const __exports = { jobstreetSearch: jobstreetSearch, default: __dflt_1 } |
| 57 | const __fns = Object.fromEntries(Object.entries(__exports).filter(([, v]) => typeof v === 'function')) |
| 58 | const __names = Object.keys(__fns) |
| 59 | if (__names.length === 0) { |
| 60 | console.log('Tidak ada fungsi yang bisa di-demo. Import modul ini dari kode lain.') |
| 61 | } else { |
| 62 | const __search = __names.find((n) => /search|cari/i.test(n)) |
| 63 | const __name = __search || __names[0] |
| 64 | const __fn = __fns[__name] |
| 65 | const __isClass = /^class\s/.test(Function.prototype.toString.call(__fn)) |
| 66 | const __defaultArgs = (() => { |
| 67 | const n = __name.toLowerCase() |
| 68 | if (/emoji/.test(n)) return [{ emoji: '๐๐' }] |
| 69 | if (/textpro|generate.*text|effect/.test(n)) return ['neon', 'Hello'] |
| 70 | if (/image|wallpaper|search|query|anime|movie|manga|news|lyrics|wiki|quote|stalk|detail/.test(n)) return ['naruto'] |
| 71 | if (/download|youtube|video|audio|music|spotify|tiktok|instagram|facebook|twitter|reels|terabox|media/.test(n)) return ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'] |
| 72 | if (/dork/.test(n)) return ['example.com', 'documents'] |
| 73 | if (/tts|speech|prompt|chat|ask|translate/.test(n)) return ['Hello world'] |
| 74 | if (/parse|format|normalize|list|features/.test(n)) return [] |
| 75 | return ['test'] |
| 76 | })() |
| 77 | let __args = __defaultArgs |
| 78 | if (process.argv.length > 2) __args = process.argv.slice(2).map((a) => { try { return JSON.parse(a) } catch { return a } }) |
| 79 | if (__args.length === 0 && !__search && !__isClass && __fn.length > 0) { |
| 80 | console.log('Fungsi: ' + __names.join(', ')) |
| 81 | console.log('Contoh: node ' + "jobstreet.js" + ' ' + __name + ' <arg>') |
| 82 | } else { |
| 83 | ;(async () => { |
| 84 | try { |
| 85 | const r = __isClass ? new __fn(...__args) : await __fn(...__args) |
| 86 | console.log(JSON.stringify(r, null, 2)) |
| 87 | } catch (e) { |
| 88 | console.error('Error: ' + (e && e.message ? e.message : e)) |
| 89 | process.exitCode = 1 |
| 90 | } |
| 91 | })() |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
Discussion & Comments0
No comments yet โ be the first to leave feedback or start a code discussion.
Sign in with your GitHub account to write comments and join the discussion.