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