diff --git a/app/Services/Feeds/MiadhuFeed.php b/app/Services/Feeds/MiadhuFeed.php index f0dfead..8c2f2ad 100644 --- a/app/Services/Feeds/MiadhuFeed.php +++ b/app/Services/Feeds/MiadhuFeed.php @@ -23,18 +23,12 @@ class MiadhuFeed implements Feed $crawler = $this->client->request('GET', "https://miadhu.mv"); $feeds = []; - $dates = []; - // scrape the dates for the articles - $crawler->filter('.middle div[class*="col-md-3 col-6 news-block"] em')->each(function ($node) use (&$dates) { - $dates[] = $node->text(); - }); - - $crawler->filter('.middle div[class*="col-md-3 col-6 news-block"] h2 a')->each(function ($node, $i) use (&$feeds, $dates) { + $crawler->filter('.middle div[class*="col-md-3 col-6 news-block"]')->each(function ($node) use (&$feeds) { $feeds[] = [ - "title" => $node->text(), - "link" => $node->attr('href'), - "date" => $dates[$i] + "title" => $node->filter('h2 a')->first()->text(), + "link" => $node->filter('h2 a')->first()->attr('href'), + "date" => $node->filter('em')->first()->text() ]; });