[HarvardHealthBlogBridge] Update (#4117)

Make article image optional as all images are representative
This commit is contained in:
tillcash 2024-05-30 19:38:08 +05:30 committed by GitHub
parent bd90109c70
commit cfd406861e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,15 @@ class HarvardHealthBlogBridge extends BridgeAbstract
const DESCRIPTION = 'Retrieve articles from health.harvard.edu'; const DESCRIPTION = 'Retrieve articles from health.harvard.edu';
const MAINTAINER = 'tillcash'; const MAINTAINER = 'tillcash';
const MAX_ARTICLES = 10; const MAX_ARTICLES = 10;
const PARAMETERS = [
[
'image' => [
'name' => 'Article Image',
'type' => 'checkbox',
'defaultValue' => 'checked',
],
],
];
public function collectData() public function collectData()
{ {
@ -46,9 +55,15 @@ class HarvardHealthBlogBridge extends BridgeAbstract
return 'Content Not Found'; return 'Content Not Found';
} }
// Remove ads // remove article image
foreach ($article->find('.inline-ad') as $remove) { if (!$this->getInput('image')) {
$remove->outertext = ''; $image = $article->find('p', 0);
$image->remove();
}
// remove ads
foreach ($article->find('.inline-ad') as $ad) {
$ad->outertext = '';
} }
return $article->innertext; return $article->innertext;