chore: id added for JobPost schema (#152)

This commit is contained in:
fasih hussain
2024-05-20 21:45:52 +05:00
committed by GitHub
parent 1ffdb1756f
commit 08d63a87a2
6 changed files with 16 additions and 0 deletions

View File

@@ -209,6 +209,7 @@ class LinkedInScraper(Scraper):
job_details = self._get_job_details(job_url)
return JobPost(
id=self._get_id(job_url),
title=title,
company_name=company,
company_url=company_url,
@@ -223,6 +224,16 @@ class LinkedInScraper(Scraper):
logo_photo_url=job_details.get("logo_photo_url"),
)
def _get_id(self, url: str):
"""
Extracts the job id from the job url
:param url:
:return: str
"""
if not url:
return None
return url.split("/")[-1]
def _get_job_details(self, job_page_url: str) -> dict:
"""
Retrieves job description and other job details by going to the job page url