mirror of
https://github.com/Bunsly/JobSpy.git
synced 2026-03-05 03:54:31 -08:00
fix(zip_recruiter): return none if location not found
This commit is contained in:
@@ -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"})
|
||||||
parts = location_string.split(", ")
|
if location_link is not None:
|
||||||
city, state = parts
|
location_string = location_link.text.strip()
|
||||||
|
parts = location_string.split(", ")
|
||||||
|
if len(parts) == 2:
|
||||||
|
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user