From 7931f37a835b3fd39093fd7de15f1b2a0263747d Mon Sep 17 00:00:00 2001 From: sysadminstory Date: Mon, 5 Feb 2024 23:30:18 +0100 Subject: [PATCH] [PepperBridgeAbstract] Fix deal image scraping (#3953) Deal Image was moved to a vuejs element, the deal image scraping was fixed. --- bridges/PepperBridgeAbstract.php | 34 +++----------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/bridges/PepperBridgeAbstract.php b/bridges/PepperBridgeAbstract.php index 73bd194da8e..45bfe2095e1 100644 --- a/bridges/PepperBridgeAbstract.php +++ b/bridges/PepperBridgeAbstract.php @@ -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']; } /**