Skip to content

Commit

Permalink
[PepperBridgeAbstract] Fix deal image scraping (RSS-Bridge#3953)
Browse files Browse the repository at this point in the history
Deal Image was moved to a vuejs element, the deal image scraping was
fixed.
  • Loading branch information
sysadminstory authored Feb 5, 2024
1 parent d175bab commit 7931f37
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions bridges/PepperBridgeAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,37 +437,9 @@ private function getDiscount($deal)
*/
private function getImage($deal)
{
$selectorLazy = implode(
' ', /* Notice this is a space! */
[
'thread-image',
'width--all-auto',
'height--all-auto',
'imgFrame-img',
'img--dummy',
'js-lazy-img'
]
);

$selectorPlain = implode(
' ', /* Notice this is a space! */
[
'thread-image',
'width--all-auto',
'height--all-auto',
'imgFrame-img',
]
);
if ($deal->find('img[class=' . $selectorLazy . ']', 0) != null) {
return json_decode(
html_entity_decode(
$deal->find('img[class=' . $selectorLazy . ']', 0)
->getAttribute('data-lazy-img')
)
)->{'src'};
} else {
return $deal->find('img[class*=' . $selectorPlain . ']', 0)->src ?? '';
}
// Get thread Image JSON content
$content = Json::decode($deal->find('div[class*=threadGrid-image]', 0)->find('div[class=js-vue2]', 0)->getAttribute('data-vue2'));
return $content['props']['threadImageUrl'];
}

/**
Expand Down

0 comments on commit 7931f37

Please sign in to comment.