Raajje mv intergration
This commit is contained in:
		
							
								
								
									
										40
									
								
								app/Services/Feeds/RaajjeMvFeed.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								app/Services/Feeds/RaajjeMvFeed.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Services\Feeds;
 | 
			
		||||
 | 
			
		||||
use Goutte\Client;
 | 
			
		||||
 | 
			
		||||
class RaajjeMvFeed implements Feed
 | 
			
		||||
{
 | 
			
		||||
    protected $client;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->client = new Client();
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Get all the latest news
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function get(): array
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        $crawler = $this->client->request('GET', "https://raajje.mv/");
 | 
			
		||||
 | 
			
		||||
        $feeds = [];
 | 
			
		||||
        $articles = $crawler->filter('div[v-if*="homepage.emme_fas"] article-grid')->first()->attr(':collection');
 | 
			
		||||
 | 
			
		||||
        $raw_response = json_decode(html_entity_decode($articles), true);
 | 
			
		||||
        foreach($raw_response as $response)
 | 
			
		||||
        {
 | 
			
		||||
            $feeds[] = [
 | 
			
		||||
                "title" => $response["heading"],
 | 
			
		||||
                "link" => "https://raajje.mv/".$response["id"],
 | 
			
		||||
                "date" => $response["approved_date"]
 | 
			
		||||
            ];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $feeds;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user