diff --git a/app/Services/Scrapers/DhuvasScraper.php b/app/Services/Scrapers/DhuvasScraper.php index 1a0d74a..93d9b2a 100644 --- a/app/Services/Scrapers/DhuvasScraper.php +++ b/app/Services/Scrapers/DhuvasScraper.php @@ -27,7 +27,7 @@ class DhuvasScraper $this->title = $node->text(); }); - // Checking for two types of article patterns + // Checking for three 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) { @@ -37,21 +37,21 @@ class DhuvasScraper } $this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text()); }); + } else if ($crawler->filter('.elementor-widget-container p[dir*="rtl"]')->count() > 0) { + $crawler->filter('.elementor-widget-container p[dir*="rtl"]')->each(function ($node) { + $this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text()); + }); } else { $crawler->filter('.elementor-widget-container > p')->each(function ($node) { $this->content[] = preg_replace("/[a-zA-Z]/", "", $node->text()); }); } - - + // Checking if the author of the article exists 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(); } - - - //Remove all the alphabets from string //preg_replace("/[a-zA-Z]/", "",$string); return [