fix(zip_recruiter): return none if location not found

pull/12/head
Cullen 2023-07-11 09:05:46 -05:00
parent 2a96fdc8a5
commit 5046fad850
1 changed files with 10 additions and 3 deletions

View File

@ -211,9 +211,16 @@ class ZipRecruiterScraper(Scraper):
:param job: :param job:
:return: location :return: location
""" """
location_string = job.find("a", {"class": "company_location"}).text.strip() location_link = job.find("a", {"class": "company_location"})
if location_link is not None:
location_string = location_link.text.strip()
parts = location_string.split(", ") parts = location_string.split(", ")
if len(parts) == 2:
city, state = parts city, state = parts
else:
city, state = None, None
else:
city, state = None, None
return Location( return Location(
country="US", country="US",
city=city, city=city,