Pattern fix
This commit is contained in:
@@ -27,12 +27,25 @@ class DhuvasScraper
|
|||||||
$this->title = $node->text();
|
$this->title = $node->text();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Checking for two types of article patterns
|
||||||
|
if ($crawler->filter('.elementor-widget-container > div.normal_text_dv')->count() > 0) {
|
||||||
|
$crawler->filter('.elementor-widget-container > div.normal_text_dv, div.normal_text_dv > p')->each(function ($node) {
|
||||||
|
|
||||||
|
// Check if any alphabet exist. (To ignore the ads in articles)
|
||||||
|
if (preg_match('/[a-zA-Z]/', $node->text())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
$crawler->filter('.elementor-widget-container > p')->each(function ($node) {
|
$crawler->filter('.elementor-widget-container > p')->each(function ($node) {
|
||||||
$this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text());
|
$this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text());
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if($crawler->filter('span[class*="elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-author"]')->count() == 1)
|
|
||||||
{
|
|
||||||
|
if ($crawler->filter('span[class*="elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-author"]')->count() == 1) {
|
||||||
$this->author = $crawler->filter('span[class*="elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-author"]')->first()->text();
|
$this->author = $crawler->filter('span[class*="elementor-icon-list-text elementor-post-info__item elementor-post-info__item--type-author"]')->first()->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user