Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * INFO LOKER - Jobstreet
- * Author : gienetic
- * Base : https://play.google.com/store/apps/details?id=com.jobstreet.jobstreet
- */
- const axios = require("axios");
- const dayjs = require("dayjs");
- async function cariLoker(pekerjaan, kota, jumlah = 10) {
- const url = "https://jobsearch-api.cloud.seek.com.au/v5/search";
- const params = {
- keywords: pekerjaan,
- where: kota,
- sitekey: "ID",
- sourcesystem: "houston",
- pageSize: jumlah,
- page: 1,
- locale: "id-ID",
- };
- try {
- const res = await axios.get(url, { params });
- const jobs = res.data.data || [];
- if (jobs.length === 0) {
- return "ā Tidak ada lowongan ditemukan.";
- }
- let hasil = `š *Hasil Pencarian Lowongan*\nš ${pekerjaan} di ${kota}\n\n`;
- jobs.forEach((job, i) => {
- const judul = job.title || "-";
- const perusahaan = job.companyName || "-";
- const lokasi = job.locations?.[0]?.label || "-";
- const tanggal = job.listingDate ? dayjs(job.listingDate).format("DD MMM YYYY") : "-";
- const gaji = job.salaryLabel || "ā Tidak dicantumkan";
- const deskripsi = job.teaser || "-";
- const logo = job.branding?.serpLogoUrl || "-";
- const tautan = `https://id.jobstreet.com/job/${job.id}`;
- hasil += `*${i + 1}. ${judul}*\n`;
- hasil += `š¢ Perusahaan : ${perusahaan}\n`;
- hasil += `š Lokasi : ${lokasi}\n`;
- hasil += `šļø Tanggal : ${tanggal}\n`;
- hasil += `š° Gaji : ${gaji}\n`;
- hasil += `š Deskripsi : ${deskripsi}\n`;
- hasil += `š¼ Logo : ${logo}\n`;
- hasil += `š Link : ${tautan}\n`;
- hasil += `āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n`;
- });
- return hasil;
- } catch (err) {
- return `ā Terjadi kesalahan: ${err.response?.status} - ${err.response?.statusText}`;
- }
- }
- module.exports = { cariLoker };
- /*
- Contoh penggunaan:
- const { cariLoker } = require("./lib/infoloker");
- (async () => {
- const hasil = await cariLoker("welder", "Sukabumi", 5);
- console.log(hasil);
- })();
- */
Advertisement
Add Comment
Please, Sign In to add comment