From 3075f4d47a46d4da5ab812f169c9f332b57f63d2 Mon Sep 17 00:00:00 2001 From: lolcat Date: Sat, 24 May 2025 20:49:49 -0400 Subject: [PATCH] fix startpage videos --- src/scraper/startpage.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/scraper/startpage.php b/src/scraper/startpage.php index ebb1737..8b79935 100644 --- a/src/scraper/startpage.php +++ b/src/scraper/startpage.php @@ -1225,11 +1225,16 @@ class startpage{ // get results foreach($json["render"]["presenter"]["regions"]["mainline"] as $category){ - - if($category["display_type"] == "video-youtube"){ - + + if( + preg_match( + '/^video-/i', + $category["display_type"] + ) + ){ + foreach($category["results"] as $video){ - + if( isset($video["thumbnailUrl"]) && $video["thumbnailUrl"] !== null @@ -1246,9 +1251,9 @@ class startpage{ "url" => null ]; } - + $out["video"][] = [ - "title" => $video["title"], + "title" => str_replace(["", ""], "", $video["title"]), "description" => $this->limitstrlen($video["description"]), "author" => [ "name" => $video["channelTitle"], @@ -1256,7 +1261,7 @@ class startpage{ "avatar" => null ], "date" => strtotime($video["publishDate"]), - "duration" => $this->hms2int($video["duration"]), + "duration" => $this->hms2int($category["display_type"] == "video-youtube" ? $video["duration"] : $video["duration"] / 1000), "views" => (int)$video["viewCount"], "thumb" => $thumb, "url" => $video["clickUrl"]