Addulive intergration
This commit is contained in:
		
							
								
								
									
										29
									
								
								app/Services/AdduLiveService.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								app/Services/AdduLiveService.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace App\Services;
 | 
			
		||||
 | 
			
		||||
use App\Services\Scrapers\AdduLiveScraper;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
 | 
			
		||||
class AdduLiveService extends Client
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Scrap all the rss articles from Press
 | 
			
		||||
     *
 | 
			
		||||
     * @return array
 | 
			
		||||
     */
 | 
			
		||||
    public function scrape(): array
 | 
			
		||||
    {
 | 
			
		||||
        //Return only the rss that contains "news" keyboard in its url
 | 
			
		||||
        $articles = $this->get("https://www.addulive.com/feed")["channel"]["item"];
 | 
			
		||||
 | 
			
		||||
        $articlesitems = [];
 | 
			
		||||
        //Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
 | 
			
		||||
        foreach ($articles as $article) {
 | 
			
		||||
            $link = $article['link'];
 | 
			
		||||
            $articlesitems[] = (new AdduLiveScraper)->extract($link);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $articlesitems;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user