【问题标题】:how to get google custom search result in json array如何在 json 数组中获取谷歌自定义搜索结果
【发布时间】:2016-07-21 09:15:44
【问题描述】:

我想在 google 最新的自定义搜索中以 json 数组的形式获取 google 搜索结果。

如何实现代码。

例如:

 {
    "responseData": {` `
        "results": [
            {
      ` `          "GsearchResultClass ": "GwebSearch",
                "unescapedUrl": "http:/ / en.wikipedia.org/wiki/Paris_Hilton",
                "url"   : "http    ://    en.wikipedi a.org/wiki/Paris_Hilton",
                "visibleUrl  "  : "en.wikipedia .org",
                "cacheUrl    "    : "http://www.google.com/search?q=cache:TwrPfhd22hYJ:en.wikipedia.org",
                "title": "<   b>Paris Hilton</b   > - Wikipedia, the free encyclopedia",
                "titleNoFormatting": "Paris Hilton - Wikipedia, the free encyclopedia",
                "content": "[1] In 2006, she released her debut album..."
            },
            {
                "GsearchResultClass": "GwebSearch",
                "unescapedUrl": "http://`   `www.imdb.com/name/nm0385296/",
                "url": "http://`    `www.imdb.com/name/nm0385296/",
                "visibleUrl":     "www.imdb.com",
                "cacheUrl":      "http://www.google.com/search?q=cache:1i34KkqnsooJ:www.imdb.com",
                "title": "<b>    Paris Hilton</b>",
                "titleNoFormatting": "Paris Hilton",
                "content": "    Self: Zoolander. Socialite <b>Paris Hilton</b>..."
            }
        ]

【问题讨论】:

    标签: android json google-custom-search


    【解决方案1】:

    如果您想要自定义搜索结果。 请阅读 Google 的Custom Search Engine (free)

    Create custom search engine

    然后转到链接以创建您的自定义搜索:

    https://cse.google.com/cse/

    或者

    你应该去:

    Google search API

    点击链接:在 APIs Explorer 中试用此 API

    插入你的参数:

    • "https://www.googleapis.com/customsearch/v1?"
      • "q=" + 关键字(例如:"Paris+Hilton")
      • "&cx=" + 你的CSE的cx代码
      • "&key=" + 您的授权 API 密钥 [在链接 API project 中,单击:A project is needed to enable APIs + Create project,然后转到 'APIs & auth' 并在 'Custom Search API' 中激活]
      • "num=" + 要返回的搜索结果数(整数)

    Execute 以显示格式为 JSON 的结果。

    【讨论】:

    猜你喜欢
    • 2018-04-06
    • 1970-01-01
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多