- linkedin refactor

pull/12/head
zacharyhampton 2023-07-10 17:47:22 -05:00 committed by Cullen Watson
parent eba455115c
commit 9042e94d7a
1 changed files with 8 additions and 2 deletions

View File

@ -16,8 +16,10 @@ class LinkedInScraper(Scraper):
self.url = "https://www.linkedin.com/jobs" self.url = "https://www.linkedin.com/jobs"
def scrape(self, scraper_input: ScraperInput) -> JobResponse: def scrape(self, scraper_input: ScraperInput) -> JobResponse:
current_page = 0
params = { params = {
"pageNum": scraper_input.page - 1, "pageNum": current_page,
"location": scraper_input.location, "location": scraper_input.location,
"distance": scraper_input.distance, "distance": scraper_input.distance,
} }
@ -58,6 +60,8 @@ class LinkedInScraper(Scraper):
if datetime_tag: if datetime_tag:
datetime_str = datetime_tag["datetime"] datetime_str = datetime_tag["datetime"]
date_posted = datetime.strptime(datetime_str, "%Y-%m-%d") date_posted = datetime.strptime(datetime_str, "%Y-%m-%d")
else:
date_posted = None
job_post = JobPost( job_post = JobPost(
title=title, title=title,
@ -74,9 +78,11 @@ class LinkedInScraper(Scraper):
job_count = int("".join(filter(str.isdigit, job_count_text))) job_count = int("".join(filter(str.isdigit, job_count_text)))
total_pages = ceil(job_count / 25) total_pages = ceil(job_count / 25)
job_response = JobResponse( job_response = JobResponse(
success=True,
jobs=job_list, jobs=job_list,
job_count=job_count, job_count=job_count,
page=scraper_input.page, page=current_page + 1,
total_pages=total_pages, total_pages=total_pages,
) )
return job_response return job_response