mirror of
https://github.com/Bunsly/JobSpy.git
synced 2026-03-04 11:34:47 -08:00
fix(linkedin): add fallback for date parsing on new job listings (#343)
LinkedIn uses two CSS classes for job posting dates: - `job-search-card__listdate` for older posts - `job-search-card__listdate--new` for recent posts (< 24h) The scraper only checked the first class, causing `date_posted` to be None for all fresh listings. This adds a fallback to also check for the `--new` variant.
This commit is contained in:
@@ -209,6 +209,10 @@ class LinkedIn(Scraper):
|
|||||||
if metadata_card
|
if metadata_card
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
if not datetime_tag and metadata_card:
|
||||||
|
datetime_tag = metadata_card.find(
|
||||||
|
"time", class_="job-search-card__listdate--new"
|
||||||
|
)
|
||||||
date_posted = None
|
date_posted = None
|
||||||
if datetime_tag and "datetime" in datetime_tag.attrs:
|
if datetime_tag and "datetime" in datetime_tag.attrs:
|
||||||
datetime_str = datetime_tag["datetime"]
|
datetime_str = datetime_tag["datetime"]
|
||||||
|
|||||||
Reference in New Issue
Block a user