구글 웹 검색 API

1 개요[ | ]

Google Web Search API
구글 웹 검색 API, 구글 검색 API
  • 2011년, 공식적으로는 deprecated[1][2]
  • 2014년 9월에 서비스 중단 예정[1][3]
  • 2014년 12월 현재도 사용은 가능하지만, 실제 구글 검색결과보다 적은 수가 검색됨

2 실습 1: 기본 호출[ | ]

curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=검색어'
[root@zetawiki ~]# curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=my_name_is_thomas_edison'
{"responseData": {"results": ... (생략) ... "responseDetails": null, "responseStatus": 200}
curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=검색어' | python -m json.tool
[root@zetawiki ~]# curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=my_name_is_thomas_edison' | python -m json.tool
{
    "responseData": {
        "cursor": {
            "currentPageIndex": 0, 
            "estimatedResultCount": "4", 
            "moreResultsUrl": "http://www.google.com/search?oe=utf8&ie=utf8&source=uds&start=0&hl=en&q=my_name_is_thomas_edison", 
            "pages": [
                {
                    "label": 1, 
                    "start": "0"
                }
            ], 
            "resultCount": "4", 
            "searchResultTime": "0.14"
        }, 
        "results": [
            {
                "GsearchResultClass": "GwebSearch", 
                "cacheUrl": "", 
                "content": "I am considered an electrical genius. I invented the phonograph. <b>My name is</b> \n<b>Thomas Edison</b>. 3. I was a nurse during the Civil War. I am a famous female \nauthor.", 
                "fileFormat": "PDF/Adobe Acrobat", 
                "title": "People from American History - TLSBooks.com", 
                "titleNoFormatting": "People from American History - TLSBooks.com", 
                "unescapedUrl": "http://www.tlsbooks.com/peoplefromamericanhistory.pdf", 
                "url": "http://www.tlsbooks.com/peoplefromamericanhistory.pdf", 
                "visibleUrl": "www.tlsbooks.com"
            }, 
... (생략)
        ]
    }, 
    "responseDetails": null, 
    "responseStatus": 200
}

3 실습 2: 검색결과 수 얻기[ | ]

curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=검색어' | python -m json.tool | grep -i count
[root@zetawiki ~]#  curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=my_name_is_thomas_edison' | python -m json.tool | grep -i count
            "estimatedResultCount": "4", 
            "resultCount": "4",
[root@zetawiki ~]# curl -s 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=the' | python -m json.tool | grep -i count
            "estimatedResultCount": "2360000000", 
            "resultCount": "2,360,000,000",

4 같이 보기[ | ]

5 주석[ | ]

  1. 1.0 1.1 https://developers.google.com/web-search/docs/?csw=1
  2. 대신 Custom Search API를 사용하라고 한다...
  3. Its last day of operation will be September 29, 2014.
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}