From cfd406861eeb6f90b61df56981cc0337ab504a06 Mon Sep 17 00:00:00 2001 From: tillcash Date: Thu, 30 May 2024 19:38:08 +0530 Subject: [PATCH] [HarvardHealthBlogBridge] Update (#4117) Make article image optional as all images are representative --- bridges/HarvardHealthBlogBridge.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bridges/HarvardHealthBlogBridge.php b/bridges/HarvardHealthBlogBridge.php index 75e7e2cf..bb6a5ede 100644 --- a/bridges/HarvardHealthBlogBridge.php +++ b/bridges/HarvardHealthBlogBridge.php @@ -7,6 +7,15 @@ class HarvardHealthBlogBridge extends BridgeAbstract const DESCRIPTION = 'Retrieve articles from health.harvard.edu'; const MAINTAINER = 'tillcash'; const MAX_ARTICLES = 10; + const PARAMETERS = [ + [ + 'image' => [ + 'name' => 'Article Image', + 'type' => 'checkbox', + 'defaultValue' => 'checked', + ], + ], + ]; public function collectData() { @@ -46,9 +55,15 @@ class HarvardHealthBlogBridge extends BridgeAbstract return 'Content Not Found'; } - // Remove ads - foreach ($article->find('.inline-ad') as $remove) { - $remove->outertext = ''; + // remove article image + if (!$this->getInput('image')) { + $image = $article->find('p', 0); + $image->remove(); + } + + // remove ads + foreach ($article->find('.inline-ad') as $ad) { + $ad->outertext = ''; } return $article->innertext;