update
This commit is contained in:
		@@ -4,7 +4,6 @@ namespace App\Services\Scrapers;
 | 
			
		||||
 | 
			
		||||
use Goutte\Client;
 | 
			
		||||
use Illuminate\Support\Carbon;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
 | 
			
		||||
class ThiladhunScraper
 | 
			
		||||
{
 | 
			
		||||
@@ -78,7 +77,7 @@ class ThiladhunScraper
 | 
			
		||||
            'date'       => Carbon::parse($date)->format("Y-m-d H:i:s"),
 | 
			
		||||
            'url'        => $url,
 | 
			
		||||
            'author'     => $this->author,
 | 
			
		||||
            'guid'       => (integer) Str::before(basename($url), '?'),
 | 
			
		||||
            'guid'       => basename($url),
 | 
			
		||||
            'topics'       =>  $this->topics ? : [
 | 
			
		||||
                [
 | 
			
		||||
                    "name" => "ވަކި މަޢުލޫއެއް ނޭންގެ",
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ namespace App\Services;
 | 
			
		||||
use App\Services\Feeds\ThiladhunFeed;
 | 
			
		||||
use App\Services\Scrapers\ThiladhunScraper;
 | 
			
		||||
use Illuminate\Support\Facades\Http;
 | 
			
		||||
use Illuminate\Support\Str;
 | 
			
		||||
 | 
			
		||||
class ThiladhunService extends Client
 | 
			
		||||
{
 | 
			
		||||
@@ -23,7 +24,8 @@ class ThiladhunService extends Client
 | 
			
		||||
        $articlesitems = [];
 | 
			
		||||
        //Looping through the articles and scraping and while scraping it creates a new instance of the scraper.
 | 
			
		||||
        foreach ($articles as $article) {
 | 
			
		||||
            $articlesitems[] = (new ThiladhunScraper)->extract($article["link"], $article["pubDate"]);
 | 
			
		||||
            //Remove query strings
 | 
			
		||||
            $articlesitems[] = (new ThiladhunScraper)->extract(Str::before($article["link"], '?'), $article["pubDate"]);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $articlesitems;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user