Skip to content

Commit

Permalink
implement 404 for LI
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed Oct 29, 2024
1 parent 5f48a50 commit 2e4aabb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jg/plucker/job_checks/spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,18 @@ def check_linkedin(
self, api_response: TextResponse, job_url: str
) -> JobCheck | Request:
self.logger.info(f"Checking {job_url} (LinkedIn)")
if api_response.status == 404:
return JobCheck(url=job_url, ok=False, reason="HTTP 404")
if api_response.css(".closed-job").get(None):
return JobCheck(url=job_url, ok=False, reason="LINKEDIN")
if api_response.css(".top-card-layout__cta-container").get(None):
return JobCheck(url=job_url, ok=True, reason="LINKEDIN")

self.logger.error(f"Failed to parse {api_response.url}\n\n{api_response.text}")
self.logger.error(
f"Failed to parse {api_response.url}, "
f"status {api_response.status}, "
f"content length {len(api_response.text)}"
f"\n\n{api_response.text}"
)
raise NotImplementedError("Failed to parse LinkedIn API response")

def check_startupjobs(
Expand Down

0 comments on commit 2e4aabb

Please sign in to comment.