Skip to content

Commit

Permalink
fix: 🐛 Change selectors due to new html structure
Browse files Browse the repository at this point in the history
LinkedIn has changed their HTML structure therefore app stopped to apply to jobs
  • Loading branch information
chakaponi committed Nov 21, 2024
1 parent 2b72062 commit a603455
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ai_hawk/job_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def job_tile_to_job(self, job_tile) -> Job:
logger.warning("Job link is missing.")

try:
job.company = job_tile.find_element(By.CLASS_NAME, 'job-card-container__primary-description').text
job.company = job_tile.find_element(By.CLASS_NAME, 'job-card-container__primary-description').text.split(' · ')[0].strip()
logger.debug(f"Job company extracted: {job.company}")
except NoSuchElementException:
logger.warning("Job company is missing.")
Expand All @@ -506,12 +506,12 @@ def job_tile_to_job(self, job_tile) -> Job:
logger.warning(f"Failed to extract job ID: {e}", exc_info=True)

try:
job.location = job_tile.find_element(By.CLASS_NAME, 'job-card-container__metadata-item').text
job.location = job_tile.find_element(By.CLASS_NAME, 'job-card-container__primary-description').text.split(' · ')[-1].strip()
except NoSuchElementException:
logger.warning("Job location is missing.")

try:
job.apply_method = job_tile.find_element(By.CLASS_NAME, 'job-card-container__apply-method').text
job.apply_method = job_tile.find_element(By.XPATH, ".//div[contains(@class, 'job-card-container__job-insight-text') and normalize-space() = 'Easy Apply']").text
except NoSuchElementException:
job.apply_method = "Applied"
logger.warning("Apply method not found, assuming 'Applied'.")
Expand Down

0 comments on commit a603455

Please sign in to comment.