This commit is contained in:
2021-01-04 14:48:36 +05:00
parent 421b447e44
commit 3933e06fa0
2 changed files with 1 additions and 2 deletions

View File

@@ -43,7 +43,6 @@ class ScrapeFeshunCommand extends Command
$source = Source::where('slug', 'feshun')->first(); $source = Source::where('slug', 'feshun')->first();
$articles = (new FeshunService)->scrape(); $articles = (new FeshunService)->scrape();
foreach ($articles as $article) { foreach ($articles as $article) {
// Attach the relationship between source and article and return the curren article instance // Attach the relationship between source and article and return the curren article instance

View File

@@ -23,7 +23,7 @@ class FeshunService extends Client
'title' => $article["title"]["rendered"], 'title' => $article["title"]["rendered"],
'og_title' => $article["title"]["rendered"], 'og_title' => $article["title"]["rendered"],
'image' => Http::get("https://feshun.mv/wp-json/wp/v2/media?include=".$article["featured_media"])->json()[0]["guid"]["rendered"], 'image' => Http::get("https://feshun.mv/wp-json/wp/v2/media?include=".$article["featured_media"])->json()[0]["guid"]["rendered"],
'content' => explode("<p>",preg_replace("/[a-zA-Z]/", "", $article["content"]["rendered"])), 'content' => explode("<p>",$article["content"]["rendered"]),
'date' => Carbon::parse($article["date"])->format("Y-m-d H:i:s"), 'date' => Carbon::parse($article["date"])->format("Y-m-d H:i:s"),
'url' => $article["link"], 'url' => $article["link"],
'author' => Http::get("https://feshun.mv/wp-json/wp/v2/users?include=".$article["author"])->json()[0]["name"], 'author' => Http::get("https://feshun.mv/wp-json/wp/v2/users?include=".$article["author"])->json()[0]["name"],