我使该api只是为了尝试某些操作,但我每天仅获得5个结果而获得过多查询
我是唯一使用它的人
我做错了吗?
<?php
header('Content-Type: application/json');
if(isset($_GET['search'])) {
$search = $_GET['search'];
$item = json_decode(file_get_contents("https://www.googleapis.com/youtube/v3/search?part=snippet&q=".urlencode($search)."&type=video&key=secret&maxResults=5"))->items;
$title = [];
$videoId = [];
for ($i=0; $i < count($item); $i++) {
$title[$i] = $item[$i]->snippet->title;
$videoId[$i] = $item[$i]->id->videoId;
}
$echo["title"] = $title;
$echo["videoId"] = $videoId;
echo json_encode($echo);
}
?>