当前位置: 首页 > 面试题库 >

Google通过API的“定义:”吗?

杜楚
2023-03-14
问题内容

我想获得使用Google特殊功能(例如“ define:[phrase]”)的搜索结果,但似乎找不到与此相关的信息。

有谁知道我可以在哪里获取JSON格式的数据(例如Google的其他API),而无需手动抓取结果页?

谢谢,以利


问题答案:

我希望我没有为此设置赏金,因为几天后我偶然发现了答案,这确实很简单。

如果您希望定义 喜欢, 这是要调用的URL :

http://www.google.com/dictionary/json?callback=a&sl=zh-CN&tl=zh-
CN&q=love

您将获得一个包含JSONP的响应流,其中包含以下内容(出于学习目的“修饰”,API在一行中全部返回):

a(
    {
       "query":"love",
       "sourceLanguage":"en",
       "targetLanguage":"en",
       "primaries":[
          {
             "type":"headword",
             "terms":[
                {
                   "type":"text",
                   "text":"love",
                   "language":"en",
                   "labels":[
                      {
                         "text":"Noun",
                         "title":"Part-of-speech"
                      }
                   ]
                },
                {
                   "type":"phonetic",
                   "text":"/ləv/",
                   "language":"und"
                },
                {
                   "type":"sound",
                   "text":"http://www.gstatic.com/dictionary/static/sounds/de/0/love.mp3",
                   "language":"und"
                }
             ],
             "entries":[
                {
                   "type":"related",
                   "terms":[
                      {
                         "type":"text",
                         "text":"loves",
                         "language":"und",
                         "labels":[
                            {
                               "text":"plural"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"An intense feeling of deep affection",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"babies fill parents with intense feelings of \x3cem\x3elove\x3c/em\x3e",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"their \x3cb\x3e\x3cem\x3elove\x3c/em\x3e for\x3c/b\x3e their country",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A deep romantic or sexual attachment to someone",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"it was \x3cem\x3elove\x3c/em\x3e at first sight",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"they were both \x3cb\x3ein \x3cem\x3elove\x3c/em\x3e with\x3c/b\x3e her",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"we were slowly \x3cb\x3efalling in \x3cem\x3elove\x3c/em\x3e\x3c/b\x3e",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A personified figure of \x3cem\x3elove\x3c/em\x3e, often represented as Cupid",
                         "language":"en"
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A great interest and pleasure in something",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"his \x3cb\x3e\x3cem\x3elove\x3c/em\x3e for\x3c/b\x3e football",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"we share a \x3cb\x3e\x3cem\x3elove\x3c/em\x3e of\x3c/b\x3e music",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"Affectionate greetings conveyed to someone on one\x27s behalf",
                         "language":"en"
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A formula for ending an affectionate letter",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"take care, lots of \x3cem\x3elove\x3c/em\x3e, Judy",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A person or thing that one \x3cem\x3eloves\x3c/em\x3e",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"she was \x3cb\x3ethe \x3cem\x3elove\x3c/em\x3e of his life\x3c/b\x3e",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"their two great \x3cem\x3eloves\x3c/em\x3e are tobacco and whiskey",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"A friendly form of address",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"it\x27s all right, \x3cem\x3elove\x3c/em\x3e",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"Used to express affectionate approval for someone",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"don\x27t fret, there\x27s a \x3cem\x3elove\x3c/em\x3e",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"(in tennis, squash, and some other sports) A score of zero; nil",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"\x3cem\x3elove\x3c/em\x3e fifteen",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"he was down two sets to \x3cem\x3elove\x3c/em\x3e",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                }
             ]
          },
          {
             "type":"headword",
             "terms":[
                {
                   "type":"text",
                   "text":"love",
                   "language":"en",
                   "labels":[
                      {
                         "text":"Verb",
                         "title":"Part-of-speech"
                      }
                   ]
                },
                {
                   "type":"phonetic",
                   "text":"/ləv/",
                   "language":"und"
                },
                {
                   "type":"sound",
                   "text":"http://www.gstatic.com/dictionary/static/sounds/de/0/love.mp3",
                   "language":"und"
                }
             ],
             "entries":[
                {
                   "type":"related",
                   "terms":[
                      {
                         "type":"text",
                         "text":"loved",
                         "language":"und",
                         "labels":[
                            {
                               "text":"past participle"
                            }
                         ]
                      },
                      {
                         "type":"text",
                         "text":"loves",
                         "language":"und",
                         "labels":[
                            {
                               "text":"3rd person singular present"
                            }
                         ]
                      },
                      {
                         "type":"text",
                         "text":"loving",
                         "language":"und",
                         "labels":[
                            {
                               "text":"present participle"
                            }
                         ]
                      },
                      {
                         "type":"text",
                         "text":"loved",
                         "language":"und",
                         "labels":[
                            {
                               "text":"past tense"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"Feel a deep romantic or sexual attachment to (someone)",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"do you \x3cem\x3elove\x3c/em\x3e me?",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                },
                {
                   "type":"meaning",
                   "terms":[
                      {
                         "type":"text",
                         "text":"Like very much; find pleasure in",
                         "language":"en"
                      }
                   ],
                   "entries":[
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"I\x27d \x3cem\x3elove\x3c/em\x3e a cup of tea, thanks",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"I just \x3cem\x3elove\x3c/em\x3e dancing",
                               "language":"en"
                            }
                         ]
                      },
                      {
                         "type":"example",
                         "terms":[
                            {
                               "type":"text",
                               "text":"a fun-\x3cem\x3eloving\x3c/em\x3e girl",
                               "language":"en"
                            }
                         ]
                      }
                   ]
                }
             ]
          }
       ]
    }
,200,null)

Google Dictionary API以回调函数(JSONP)的形式返回。在处理函数调用中的JSON之前,必须删除回调函数数据。

这意味着要删除第一个之前的{所有内容,最后一个之后的所有内容}

在此之后,您就完成了!这就是您需要的所有信息,并且在搜索Google时,它们基本上是相同的(实际上是更多!)信息define love



 类似资料:
  • 问题内容: 我正在尝试通过Google App Engine随附的App Identity 接口使用Google Drive API 。基本上,这使我的Web应用程序可以在服务器之间与Google的API通信。 我不需要用户登录,只需要显示自己的Google云端硬盘文档即可。 但是,在设置了所有适当的值和范围并启用控制台页面上所有正确的Google Drive旋钮后,仍然可以通过以下简单的GET请

  • 我需要在google workspace上自动化一些流程,现在我只能通过API激活Gmail,我在任何地方都找不到任何资源或示例。 感谢您的帮助,指出参考或答案。 更新: 所以我有谷歌工作区,我正在研究自动用户和他们的gmail帐户。从屏幕截图中,我可以简单地点击“激活Gmail”,它会检查我的MX记录并激活它,但我正在寻找一个解决方案,在那里我可以使用Ruby通过谷歌API来实现。

  • 我对谷歌应用编程接口非常陌生,我有麻烦了。我留档谷歌照片APIJava,然后我在谷歌API控制台创建OAuth凭据并下载它(credentials.json文件)。之后,我试图访问谷歌照片。这里是代码从留档: 但是我不明白如何创建凭据对象,将其传递给FixedCreentialsProvider.create()方法 你能给我一些解释/链接吗?

  • 我正在尝试通过REST API创建一个新用户,我正在发送此POST 后 /admin/realms/myrealm/users 标题:授权:承载(生成的令牌,这部分可以)内容类型:应用程序/json 身体: 用户创建正常,但密码不起作用,当我尝试登录时,它声称我的凭据无效。

  • 问题内容: 我正在尝试找出如何使用Google Books API通过ISBN搜索书籍。我需要编写一个程序来搜索ISBN,然后打印出标题,作者和版本。我尝试使用,但是这不允许我按ISBN进行搜索,而且我没有找到获取所需信息的方法(将ISBN放入其中时没有结果)。我现在所拥有的是: 如果有人对如何提高效率有任何建议,请告诉我。新代码: 问题答案: 您是否正在使用不赞成使用的数据API? 借助Book

  • 我对谷歌API很陌生,我有点迷路了:) 首先,我玩了谷歌API资源管理器,一切都很好,我所有的要求。 然后,我开始编写一个小的Python脚本来授权并通过服务帐户调用API。 看起来是这样的: 然而,虽然我认为这是一种好,我仍然得到这个错误 我想我在这里错过的是创建我的令牌(?)在调用url之前?但这是如何产生的呢?我知道有1000个例子,我使用了一些已经在github中的脚本,它们可以工作,但是