如何在谷歌书api中获得更多书籍

时间:2016-01-14 13:43:38

标签: javascript angularjs google-api

在使用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();

});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
&#13;
&#13;
&#13;

但是当我搜索时我想要超过40本书,我想知道是否还有其他替代方案我可以使用谷歌book-api以及它是什么或者是否有解决方案来解决此问题

1 个答案:

答案 0 :(得分:0)

要检索的结果的最大允许值为40。

来自https://developers.google.com/books/docs/v1/using?hl=en

Sub Export()
    Dim NewWorkbook As Workbook
    Dim Ws As Worksheet
    Dim fPath As String, fName As String
    Dim i As Long
    Dim RowsToDelete As Range

    Application.ScreenUpdating = False
    Application.DisplayAlerts = False

    Set NewWorkbook = Workbooks.Add

    fPath = "D:\@Inbox\"
    fName = VBA.Format(VBA.Date, "YYYY-MM-DD") & " " & VBA.Format(VBA.Time, "hhmm") & " " & "accr " & VBA.Format(VBA.DateSerial(VBA.Year(VBA.Date), VBA.Month(VBA.Date), 1), "YYYY_MM") & " city"

    NewWorkbook.SaveAs fPath & fName, xlOpenXMLWorkbook

    ThisWorkbook.Worksheets(Array("Accr", "Pivot", "Segments")).Copy NewWorkbook.Worksheets(1)

    For Each Ws In NewWorkbook.Worksheets
        With Ws
            If Not .Name = "Accr" And Not .Name = "Pivot" And Not .Name = "Segments" Then
                .Delete
            ElseIf Ws.Name = "Accr" Then
                For i = 4 To .Cells(.Rows.Count, 1).End(xlUp).Row
                    If Not .Cells(i, 1) = .Cells(i, 1) = Month(ThisWorkbook.Worksheets("Mon").Cells(19, 2)) And Not .Cells(i, 2) = "booked" And Not .Cells(i, 35) = "Frankfurt" Then
                        If RowsToDelete Is Nothing Then
                            Set RowsToDelete = .Rows(i).EntireRow
                        Else
                            Set RowsToDelete = Union(RowsToDelete, .Rows(i).EntireRow)
                        End If
                    End If
                Next i
                If Not RowsToDelete Is Nothing Then
                    RowsToDelete.Delete xlUp
                End If
            ElseIf .Name = "Pivot" Or .Name = "Segments" Then
                .Visible = xlSheetHidden
                .UsedRange = Ws.UsedRange.Value
            End If
        End With
    Next Ws

    NewWorkbook.Save
    NewWorkbook.Close

    Application.Goto ThisWorkbook.Worksheets("Menu =>").Cells(1, 3)
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True

End Sub

您需要发送多个请求(但请检查是否存在每日限制)。