Voice intergration
This commit is contained in:
		
							
								
								
									
										28
									
								
								app/Services/Feeds/VoiceFeed.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								app/Services/Feeds/VoiceFeed.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace App\Services\Feeds;
 | 
			
		||||
 | 
			
		||||
use Goutte\Client;
 | 
			
		||||
 | 
			
		||||
class VoiceFeed
 | 
			
		||||
{
 | 
			
		||||
    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://voice.mv/");
 | 
			
		||||
 | 
			
		||||
        return $crawler->filter('div[id*="latest-news"] .content a')
 | 
			
		||||
                            ->extract(['_text', '_attr' => 'href']);             
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user