From fdbdaffbe3fb8207302dafd8a312d63a0df8f2ff Mon Sep 17 00:00:00 2001 From: Umair Jibran Date: Fri, 8 Nov 2024 21:12:23 +0500 Subject: [PATCH] 32-support-lever-board (#35) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ feat: Copy to clipboard by button * ✨ feat: add support for python scrapping * ✨ feat: allow requesting from lever sites --- addon/src/main.js | 7 ++++--- python/app.py | 4 +++- python/main.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/addon/src/main.js b/addon/src/main.js index ca7c07d..a98fa72 100644 --- a/addon/src/main.js +++ b/addon/src/main.js @@ -47,9 +47,6 @@ function showCoverLetter(coverLetter) { const copyButton = document.createElement("button"); copyButton.innerHTML = "Copy to Clipboard"; copyButton.classList.add("btn", "btn-primary", "mt-2"); - copyButton.onclick = function () { - copyToClipboard(coverLetter); - }; const div = document.createElement("div"); div.innerHTML = `

Cover Letter:

@@ -60,6 +57,9 @@ function showCoverLetter(coverLetter) { clArea.rows = 10; clArea.style.width = "100%"; clArea.style.resize = "none"; + copyButton.onclick = function () { + copyToClipboard(clArea.value); + }; const mainDiv = document.getElementById("popup"); mainDiv.appendChild(copyButton); @@ -74,6 +74,7 @@ generateCLButton.addEventListener("click", async function () { const baseUrl = [savedHost, "job-details"].join("/"); let jobBoard = ""; if (currentTab.url.includes("greenhouse")) jobBoard = "greenhouse"; + if (currentTab.url.includes("lever")) jobBoard = "lever"; if (!jobBoard) { notSupported(currentTab.title, currentTab.url); diff --git a/python/app.py b/python/app.py index e849cc5..0988fc7 100644 --- a/python/app.py +++ b/python/app.py @@ -2,7 +2,7 @@ from dotenv import load_dotenv from flask_cors import CORS -from main import fetch_job_details_from_greenhouse +from main import fetch_job_details_from_greenhouse, fetch_job_details_from_lever from services.openai import generate_cover_letter from services.resume_best_match import get_best_match_from_resume from services.resume_vectorizor import vectorize_resume @@ -33,6 +33,8 @@ def get_job_details(job_board): match job_board: case "greenhouse": job_details = fetch_job_details_from_greenhouse(job_url) + case "lever": + job_details = fetch_job_details_from_lever(job_url) resume_vectors, resume_segments = vectorize_resume() best_match_section = get_best_match_from_resume(job_details, resume_vectors, resume_segments) diff --git a/python/main.py b/python/main.py index f2d93c6..2451e5a 100644 --- a/python/main.py +++ b/python/main.py @@ -13,3 +13,16 @@ def fetch_job_details_from_greenhouse(url): text = text[:text.find("Apply for this job")] return text + + +def fetch_job_details_from_lever(url): + headers = { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' + } + response = requests.get(url, headers=headers) + soup = BeautifulSoup(response.content, 'html.parser') + + text = soup.get_text() + text = text[:text.find("Apply for this job")] + + return text