feat: Ability to query by time posted for linkedin, indeed, glassdoor, ziprecruiter (#103)

This commit is contained in:
VitaminB16
2024-02-09 20:02:03 +00:00
committed by GitHub
parent 2563c5ca08
commit 91b137ef86
7 changed files with 53 additions and 23 deletions

View File

@@ -363,12 +363,15 @@ class IndeedScraper(Scraper):
@staticmethod
def add_params(scraper_input: ScraperInput, page: int) -> dict[str, str | Any]:
# `fromage` is the posting time filter in days
fromage = max(scraper_input.hours_old // 24, 1) if scraper_input.hours_old else None
params = {
"q": scraper_input.search_term,
"l": scraper_input.location if scraper_input.location else scraper_input.country.value[0].split(',')[-1],
"filter": 0,
"start": scraper_input.offset + page * 10,
"sort": "date"
"sort": "date",
"fromage": fromage,
}
if scraper_input.distance:
params["radius"] = scraper_input.distance
@@ -405,8 +408,7 @@ class IndeedScraper(Scraper):
)
return is_remote_in_attributes or is_remote_in_description or is_remote_in_location
@staticmethod
def get_job_details(job_keys: list[str]) -> dict:
def get_job_details(self, job_keys: list[str]) -> dict:
"""
Queries the GraphQL endpoint for detailed job information for the given job keys.
"""
@@ -478,7 +480,7 @@ class IndeedScraper(Scraper):
}}
"""
}
response = requests.post(url, headers=headers, json=payload)
response = requests.post(url, headers=headers, json=payload, proxies=self.proxy)
if response.status_code == 200:
return response.json()['data']['jobData']['results']
else: