fix thiladhun

This commit is contained in:
Mohamed jinas
2024-01-07 21:42:31 +05:00
parent c8329962b7
commit 0589b19843
3 changed files with 29 additions and 25 deletions

View File

@@ -18,22 +18,23 @@ class ThiladhunFeed implements Feed
*/
public function get() : array
{
$crawler = $this->client->request('GET', "https://www.thiladhun.com");
$feeds = [];
$crawler->filter('div[class*="posts-listing posts-list"] article')->each(function ($node) use (&$feeds) {
$feeds[] = [
"title" => $node->filter('.post__title a')->text(),
"link" => $node->filter('.post__title a')->attr('href'),
"date" => $node->filter('time')->first()->attr('datetime')
];
// Assuming 'ފަހުގެ' is a unique identifier for the section of interest
$crawler->filter('.elementor-element:contains("ފަހުގެ")')->nextAll('.elementor-post')->each(function ($node) use (&$feeds) {
$title = $node->filter('.elementor-heading-title a')->count() ? $node->filter('.elementor-heading-title a')->text() : null;
$link = $node->filter('.elementor-heading-title a')->count() ? $node->filter('.elementor-heading-title a')->attr('href') : null;
if ($title && $link) {
$feeds[] = [
"title" => $title,
"link" => $link,
];
}
});
return $feeds;
}
}