소스 검색

fix startpage videos

lolcat 1 년 전
부모
커밋
a0545b6006
1개의 변경된 파일8개의 추가작업 그리고 3개의 파일을 삭제
  1. 8 3
      scraper/startpage.php

+ 8 - 3
scraper/startpage.php

@@ -1226,7 +1226,12 @@ class startpage{
 		// get results
 		// get results
 		foreach($json["render"]["presenter"]["regions"]["mainline"] as $category){
 		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){
 				foreach($category["results"] as $video){
 					
 					
@@ -1248,7 +1253,7 @@ class startpage{
 					}
 					}
 					
 					
 					$out["video"][] = [
 					$out["video"][] = [
-						"title" => $video["title"],
+						"title" => str_replace(["", ""], "", $video["title"]),
 						"description" => $this->limitstrlen($video["description"]),
 						"description" => $this->limitstrlen($video["description"]),
 						"author" => [
 						"author" => [
 							"name" => $video["channelTitle"],
 							"name" => $video["channelTitle"],
@@ -1256,7 +1261,7 @@ class startpage{
 							"avatar" => null
 							"avatar" => null
 						],
 						],
 						"date" => strtotime($video["publishDate"]),
 						"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"],
 						"views" => (int)$video["viewCount"],
 						"thumb" => $thumb,
 						"thumb" => $thumb,
 						"url" => $video["clickUrl"]
 						"url" => $video["clickUrl"]