mirror of
https://github.com/Bunsly/JobSpy.git
synced 2026-03-05 03:54:31 -08:00
@@ -19,11 +19,9 @@ class JobType(Enum):
|
||||
|
||||
|
||||
class Location(BaseModel):
|
||||
country: str
|
||||
country: str = "USA"
|
||||
city: str = None
|
||||
state: str = None
|
||||
postal_code: str = None
|
||||
address: str = None
|
||||
|
||||
|
||||
class CompensationInterval(Enum):
|
||||
@@ -38,7 +36,7 @@ class Compensation(BaseModel):
|
||||
interval: CompensationInterval
|
||||
min_amount: float
|
||||
max_amount: float
|
||||
currency: str = "US"
|
||||
currency: str = "USA"
|
||||
|
||||
|
||||
class JobPost(BaseModel):
|
||||
|
||||
@@ -125,7 +125,6 @@ class IndeedScraper(Scraper):
|
||||
city=job.get("jobLocationCity"),
|
||||
state=job.get("jobLocationState"),
|
||||
postal_code=job.get("jobLocationPostal"),
|
||||
country="US",
|
||||
),
|
||||
job_type=job_type,
|
||||
compensation=compensation,
|
||||
|
||||
@@ -167,9 +167,6 @@ class LinkedInScraper(Scraper):
|
||||
:param metadata_card
|
||||
:return: location
|
||||
"""
|
||||
location = Location(
|
||||
country="US",
|
||||
)
|
||||
if metadata_card is not None:
|
||||
location_tag = metadata_card.find(
|
||||
"span", class_="job-search-card__location"
|
||||
@@ -179,7 +176,6 @@ class LinkedInScraper(Scraper):
|
||||
if len(parts) == 2:
|
||||
city, state = parts
|
||||
location = Location(
|
||||
country="US",
|
||||
city=city,
|
||||
state=state,
|
||||
)
|
||||
|
||||
@@ -292,7 +292,6 @@ class ZipRecruiterScraper(Scraper):
|
||||
else:
|
||||
city, state = None, None
|
||||
return Location(
|
||||
country="US",
|
||||
city=city,
|
||||
state=state,
|
||||
)
|
||||
|
||||
@@ -23,6 +23,7 @@ async def scrape_jobs(scraper_input: ScraperInput) -> Dict[str, JobResponse]:
|
||||
:param scraper_input:
|
||||
:return: Dict[str, JobResponse]: where each key is a site
|
||||
"""
|
||||
|
||||
def scrape_site(site: Site) -> Tuple[str, JobResponse]:
|
||||
scraper_class = SCRAPER_MAPPING[site]
|
||||
scraper = scraper_class()
|
||||
@@ -30,7 +31,9 @@ async def scrape_jobs(scraper_input: ScraperInput) -> Dict[str, JobResponse]:
|
||||
return (site.value, scraped_data)
|
||||
|
||||
with ThreadPoolExecutor() as executor:
|
||||
resp_dict = {site: resp for site, resp in executor.map(scrape_site, scraper_input.site_type)}
|
||||
resp_dict = {
|
||||
site: resp
|
||||
for site, resp in executor.map(scrape_site, scraper_input.site_type)
|
||||
}
|
||||
|
||||
return resp_dict
|
||||
|
||||
|
||||
Reference in New Issue
Block a user