enh: estimated salary (#169)

pull/170/head v1.1.59
Cullen Watson 2024-07-16 19:20:34 -05:00 committed by GitHub
parent d8d33d602f
commit 88c95c4ad5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "python-jobspy" name = "python-jobspy"
version = "1.1.58" version = "1.1.59"
description = "Job scraper for LinkedIn, Indeed, Glassdoor & ZipRecruiter" description = "Job scraper for LinkedIn, Indeed, Glassdoor & ZipRecruiter"
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"] authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
homepage = "https://github.com/Bunsly/JobSpy" homepage = "https://github.com/Bunsly/JobSpy"

View File

@ -226,7 +226,7 @@ class IndeedScraper(Scraper):
country=job.get("location", {}).get("countryCode"), country=job.get("location", {}).get("countryCode"),
), ),
job_type=job_type, job_type=job_type,
compensation=self._get_compensation(job), compensation=self._get_compensation(job["compensation"]),
date_posted=date_posted, date_posted=date_posted,
job_url=job_url, job_url=job_url,
job_url_direct=( job_url_direct=(
@ -281,14 +281,19 @@ class IndeedScraper(Scraper):
return job_types return job_types
@staticmethod @staticmethod
def _get_compensation(job: dict) -> Compensation | None: def _get_compensation(compensation: dict) -> Compensation | None:
""" """
Parses the job to get compensation Parses the job to get compensation
:param job: :param job:
:param job:
:return: compensation object :return: compensation object
""" """
comp = job["compensation"]["baseSalary"] if not compensation["baseSalary"] and not compensation["estimated"]:
return None
comp = (
compensation["baseSalary"]
if compensation["baseSalary"]
else compensation["estimated"]["baseSalary"]
)
if not comp: if not comp:
return None return None
interval = IndeedScraper._get_compensation_interval(comp["unitOfWork"]) interval = IndeedScraper._get_compensation_interval(comp["unitOfWork"])
@ -300,7 +305,11 @@ class IndeedScraper(Scraper):
interval=interval, interval=interval,
min_amount=int(min_range) if min_range is not None else None, min_amount=int(min_range) if min_range is not None else None,
max_amount=int(max_range) if max_range is not None else None, max_amount=int(max_range) if max_range is not None else None,
currency=job["compensation"]["currencyCode"], currency=(
compensation["estimated"]["currencyCode"]
if compensation["estimated"]
else compensation["currencyCode"]
),
) )
@staticmethod @staticmethod
@ -388,6 +397,18 @@ class IndeedScraper(Scraper):
}} }}
}} }}
compensation {{ compensation {{
estimated {{
currencyCode
baseSalary {{
unitOfWork
range {{
... on Range {{
min
max
}}
}}
}}
}}
baseSalary {{ baseSalary {{
unitOfWork unitOfWork
range {{ range {{