Skip to content

Commit

Permalink
fix(route/linkedin): handle missing elements in jobs parsing (#15438)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoukuncheng authored May 2, 2024
1 parent e030be0 commit 12b7f55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/routes/linkedin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ function parseJobSearch(data) {
const jobs = $('li')
.map((i, elem) => {
const elemHtml = $(elem);
const link = elemHtml.find('a.base-card__full-link').attr('href').split('?')[0];
const title = elemHtml.find('h3.base-search-card__title').text().trim();
const company = elemHtml.find('h4.base-search-card__subtitle').text().trim();
const location = elemHtml.find('span.job-search-card__location').text().trim();
const pubDate = elemHtml.find('time').attr('datetime');
const link = elemHtml.find('a.base-card__full-link, a.base-card--link')?.attr('href')?.split('?')[0];
const title = elemHtml.find('h3.base-search-card__title')?.text()?.trim();
const company = elemHtml.find('h4.base-search-card__subtitle')?.text()?.trim();
const location = elemHtml.find('span.job-search-card__location')?.text()?.trim();
const pubDate = elemHtml.find('time')?.attr('datetime');

return new Job(title, link, company, location, pubDate);
})
Expand Down

0 comments on commit 12b7f55

Please sign in to comment.