Skip to content

Commit 88c95c4

Browse files
author
Cullen Watson
authored
enh: estimated salary (#169)
1 parent d8d33d6 commit 88c95c4

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "python-jobspy"
3-
version = "1.1.58"
3+
version = "1.1.59"
44
description = "Job scraper for LinkedIn, Indeed, Glassdoor & ZipRecruiter"
55
authors = ["Zachary Hampton <zachary@bunsly.com>", "Cullen Watson <cullen@bunsly.com>"]
66
homepage = "https://github.com/Bunsly/JobSpy"

src/jobspy/scrapers/indeed/__init__.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def _process_job(self, job: dict) -> JobPost | None:
226226
country=job.get("location", {}).get("countryCode"),
227227
),
228228
job_type=job_type,
229-
compensation=self._get_compensation(job),
229+
compensation=self._get_compensation(job["compensation"]),
230230
date_posted=date_posted,
231231
job_url=job_url,
232232
job_url_direct=(
@@ -281,14 +281,19 @@ def _get_job_type(attributes: list) -> list[JobType]:
281281
return job_types
282282

283283
@staticmethod
284-
def _get_compensation(job: dict) -> Compensation | None:
284+
def _get_compensation(compensation: dict) -> Compensation | None:
285285
"""
286286
Parses the job to get compensation
287287
:param job:
288-
:param job:
289288
:return: compensation object
290289
"""
291-
comp = job["compensation"]["baseSalary"]
290+
if not compensation["baseSalary"] and not compensation["estimated"]:
291+
return None
292+
comp = (
293+
compensation["baseSalary"]
294+
if compensation["baseSalary"]
295+
else compensation["estimated"]["baseSalary"]
296+
)
292297
if not comp:
293298
return None
294299
interval = IndeedScraper._get_compensation_interval(comp["unitOfWork"])
@@ -300,7 +305,11 @@ def _get_compensation(job: dict) -> Compensation | None:
300305
interval=interval,
301306
min_amount=int(min_range) if min_range is not None else None,
302307
max_amount=int(max_range) if max_range is not None else None,
303-
currency=job["compensation"]["currencyCode"],
308+
currency=(
309+
compensation["estimated"]["currencyCode"]
310+
if compensation["estimated"]
311+
else compensation["currencyCode"]
312+
),
304313
)
305314

306315
@staticmethod
@@ -388,6 +397,18 @@ def _get_compensation_interval(interval: str) -> CompensationInterval:
388397
}}
389398
}}
390399
compensation {{
400+
estimated {{
401+
currencyCode
402+
baseSalary {{
403+
unitOfWork
404+
range {{
405+
... on Range {{
406+
min
407+
max
408+
}}
409+
}}
410+
}}
411+
}}
391412
baseSalary {{
392413
unitOfWork
393414
range {{

0 commit comments

Comments
 (0)