Skip to content

Commit

Permalink
[IndeedBridge] fix: broken bridge
Browse files Browse the repository at this point in the history
The html was reworked.
  • Loading branch information
dvikan authored and em92 committed Mar 24, 2022
1 parent b6d1c7a commit f766193
Showing 1 changed file with 7 additions and 32 deletions.
39 changes: 7 additions & 32 deletions bridges/IndeedBridge.php
Expand Up @@ -143,41 +143,25 @@ public function collectData() {

$this->title = $html->find('h1', 0)->innertext;

// Use local translation of the word "Rating"
$rating_local = $html->find('a[data-id="rating_desc"]', 0)->plaintext;

foreach($html->find('#cmp-content [id^="cmp-review-"]') as $review) {
foreach($html->find('.cmp-ReviewsList div[itemprop="review"]') as $review) {
$item = array();

$rating = $review->find('.cmp-ratingNumber', 0)->plaintext;
$title = $review->find('.cmp-review-title > span', 0)->plaintext;
$comment = $this->beautifyComment($review->find('.cmp-review-content-container', 0));
$title = $review->find('h2[data-testid="title"]', 0)->innertext;
$rating = $review->find('meta[itemprop="ratingValue"]', 0)->getAttribute('content');
$comment = $review->find('span[itemprop="reviewBody"]', 0)->innertext;

$item['uri'] = $review->find('.cmp-review-share-popup-item-link--copylink', 0)->href;
$item['title'] = "{$rating_local} {$rating} / {$title}";
$item['timestamp'] = $review->find('.cmp-review-date-created', 0)->plaintext;
$item['author'] = $review->find('.cmp-reviewer', 0)->plaintext;
$item['uri'] = $review->find('a[data-tn-element="individualReviewLink"]', 0)->href;
$item['title'] = "$title | ($rating)";
$item['author'] = $review->find('span > meta[itemprop="name"]', 0)->getAttribute('content');
$item['content'] = $comment;
//$item['enclosures']
$item['categories'][] = $review->find('.cmp-reviewer-job-location', 0)->plaintext;
//$item['uid']

$this->items[] = $item;

if(count($this->items) >= $limit) {
break;
}
}

// Break if no more pages available.
if($next = $html->find('a[data-tn-element="next-page"]', 0)) {
$url = $next->href;
} else {
break;
}

} while(count($this->items) < $limit);

}

public function getURI() {
Expand Down Expand Up @@ -232,13 +216,4 @@ public function detectParameters($url) {
'limit' => $limit,
);
}

private function beautifyComment($comment) {
foreach($comment->find('.cmp-bold') as $bold) {
$bold->tag = 'strong';
$bold->removeClass('cmp-bold');
}

return $comment;
}
}

0 comments on commit f766193

Please sign in to comment.