在使用Google Book-API服务构建书店网站时,我观察到Google不允许请求超过40本书的项目,并且获取的代码是这样的
appMainModule.controller("AfricanNovelsModule", function ($scope, $http, $location) {
$scope.AfricanNovelsbookdetails = [];
$scope.i = [];
$scope.updateSearch = function () {
//var search = document.getElementById("inputSearch").value;
var linkUrl = 'https://www.googleapis.com/books/v1/volumes?q=African+folklore&maxResults=40&orderBy=newest';
document.getElementById("ScriptSection").innerHTML = '<script id="widget" type="text/javascript" src="' + linkUrl + '" />';
// getResponse();
$http.get(linkUrl).then(function (res) {
$scope.AfricanNovelsbookdetails = [];
for (var i = 0, content = res.data.items.length; i < content; i++) {
if (typeof res.data.items[i].volumeInfo.imageLinks === undefined) {
} else {
$scope.AfricanNovelsbookdetails.push(res.data.items[i]);
//console.log($scope.Comicbookdetails[i]);
//console.log($scope.Comicbookdetails[i].volumeInfo.industryIdentifiers[0]);
}
}
// console.log($scope.Comicbookdetails);
$scope.i = generateRandom(res.data.items.length);
// console.log($scope.i);
}, function (err) {
console.log(err);
});
}
$scope.updateSearch();
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
但是当我搜索时,我想要 40 多本书,我想知道除了 Google Book-API 之外,我是否可以使用其他替代方案以及它是什么,或者是否有解决方案修复
要检索的结果的最大允许值为 40。
从 https://developers.google.com/books/docs/v1/using?hl=en
Maximum allowable value: maxResults=40.
您将需要发送多个请求(但请检查是否有每日限制)。