From 7086227a98d8e4e72d30dcc838fbff51830da0a8 Mon Sep 17 00:00:00 2001 From: Mohamed jinas Date: Thu, 10 Jun 2021 00:40:01 +0500 Subject: [PATCH] update --- app/Services/Scrapers/ThiladhunScraper.php | 3 +-- app/Services/ThiladhunService.php | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Services/Scrapers/ThiladhunScraper.php b/app/Services/Scrapers/ThiladhunScraper.php index 554e464..3ef4834 100644 --- a/app/Services/Scrapers/ThiladhunScraper.php +++ b/app/Services/Scrapers/ThiladhunScraper.php @@ -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" => "ވަކި މަޢުލޫއެއް ނޭންގެ", diff --git a/app/Services/ThiladhunService.php b/app/Services/ThiladhunService.php index 2db5541..8f4fd20 100644 --- a/app/Services/ThiladhunService.php +++ b/app/Services/ThiladhunService.php @@ -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;