不過試作之後,發現google search api只能搜尋64筆的資料,無法全部顯示。
試作:
<!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Web Search API</title>
<!--引入函式庫-->
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
google.load('search', '1');
function OnLoad() {
var searchControl = new google.search.SearchControl();
//搜尋的類型
searchControl.addSearcher(new google.search.WebSearch());
searchControl.addSearcher(new google.search.BlogSearch());
//searchControl.addSearcher(new google.search.VideoSearch());
//searchControl.addSearcher(new google.search.NewsSearch());
//searchControl.addSearcher(new google.search.ImageSearch());
//searchControl.addSearcher(new google.search.BookSearch());
//searchControl.addSearcher(new google.search.PatentSearch());
//設定搜尋的範圍
//var localSearch = new google.search.LocalSearch();
//localSearch.setCenterPoint("");
//searchControl.addSearcher(localSearch);
// 繪製資料
searchControl.draw(document.getElementById("draw1"));
// 執行指定的搜尋條件
searchControl.execute("暖化");
}
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<div id="drawl">Loading</div>
</body>
</html>