问题标签 [google-search-api]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - Implementing Google Custom Search API through Greasemonkey
I want to implement the Google custom search API with Greasemonkey, and so far my trials have met with mostly failures. The goal of the code is to inject a custom search box into an existing site (I'm trying to do this for MATLAB's documentation pages, but the injected code should really work with any site). I have attempted many methods suggested by searches on the net(mostly pertaining to implementation of JQuery or Google language api in Greasemonkey) and none have worked for the custom search api...
I think there might be some problem with the variable scope, but please let me know if anyone has any suggestions on getting it to work...
- debug_1: Returns a valid object
- debug_2: Returns a valid object
- debug_3: Returns a valid string ('en')
- debug_3: Returns undefined
- Likewise I have tried letting searchLoaded -> w.searchLoaded and removed the statement (google = w.google) but in that case all debugs return undefined.
Interestingly, when I used the Javascript shell bookmarklet and reassigned the functions gLoaded() and searchLoaded() non-Greasemonkey counterparts(no unsafeWindow concerns) through the command line, everything just worked as intended. A lovely search box shows up where its supposed to be.
Besides any suggestions to get it working, I was wondering...
How come google.search.CurrentLocale returned valid string, where as the constructor google.search.CustomSearchControl() could not be loaded?
When I assigned searchLoaded as unsafeWindow.searchLoaded(see last note above), the google objects are no longer visible to the function even though they should be under the window scope by default. HOWEVER, when I assigned the function those very same values under the javascript shell, everything worked! Is Greasemonkey somehow shielding those variables even though I have explicitly defined the function to be in the window scope?
I have tried variations with different schemes(location hack, @required, google.setOnLoadCallback...), but none of them worked for me.
Please let me know of ANY... and I mean ANY suggestions, I'm running out of ideas...
Thanks!
drupal - 通过 XML 而非 iframe 的 Google 搜索结果
我正在寻找一个使用“谷歌自定义搜索 API”的谷歌搜索模块, 以便我可以在我的页面上提取结果并将它们主题化。
我知道google_cse 模块。 但是该模块不允许您自定义拉取结果的外观,因为它是通过 iframe 进行的。我正在寻找的内容更像是您在访问“Google 自定义搜索 API”页面时看到的内容。您可以在那里看到,使用此 API,您可以拉取结果服务器端并使用它做您需要做的事情。
我一直在寻找几个小时没有运气。如果它不存在,我愿意创建一个模块,但我不想重复努力。有谁知道这样的模块是否存在?
更新:
有人已经为 google_cse 模块编写了一个补丁,它使用 XML 而不是 iframe 作为第三个选项。
此外,事实证明,搜索结果可以是主题,但来自http://code.google.com/apis/customsearch/docs/ui.html#results的 google 自定义搜索仪表板。但是,使用此路线可能进行的更改是有限的。
Google 确实提供了通过 XML 下载搜索结果的可能性。显然,这将导致更好地控制结果内容,如下所述@Mark Trapp
python - 删除谷歌搜索 api 中的重复项?
我正在通过谷歌搜索 api 在我的应用程序中执行谷歌搜索。它给了我重复的结果。如何避免。我参考http://code.google.com/apis/ajaxsearch/documentation/reference.html#_intro_fonje
java - 您如何以编程方式搜索 Google 的 Java API
有谁知道是否以及如何以编程方式搜索 Google - 特别是如果有 Java API 的话?
google-search-api - 使用来自主要搜索引擎的 API 构建基于搜索的应用程序:google、bing、yahoo - 谁提供搜索 API?
我需要提供搜索功能作为我的应用程序的基石(基本上我认为我可以制作比谷歌、必应、雅虎提供的更好的界面——我知道的大胆声明)。因此,我不会从头开始构建一个完整的搜索引擎,我宁愿使用主要搜索引擎的 API 提供程序,并简单地修改将结果呈现给访问者的界面。我是 Google fanboi,最初尝试使用 Google Search AJAX API。但是,我非常失望,因为我几乎无法改变任何东西。
具体来说;
我需要一个 API,它可以让我以编程方式从主要搜索引擎中提取结果,并让我以我想要的风格和好东西输出它们。
我不希望通过在好的结果之间插入废话来改变向用户呈现搜索结果的顺序(这违背了我的理念)。但是我想在每个搜索结果周围包裹大量的 php/javascript,这样我就可以完全控制每个结果的图形呈现方式。
我听说过 BING API 2.0,那会比 Google AJAX API 更灵活吗?如果任何当前的搜索提供商现在为此目的提供 API,任何人都可以提供输出吗?
ruby-on-rails - 搜索 Google 缓存的任何 API?
我正在尝试在 Google 缓存中进行搜索,因此我需要触发此查询:
并从页面中获取一些内容,例如时间戳。但是当我使用 curl (ruby) 执行此操作时,它给出了一个权限被拒绝错误,即抓取被阻止,这是意料之中的。
那么,有没有办法搜索谷歌缓存(API 或某种解决方法抓取)并提取一些信息,如时间戳?
search - 如何实现搜索?
我们正在尝试将搜索添加到我们的网站,并希望此搜索功能仅搜索以下内容:
- 文件——显然在我们的案例中我们需要解析 PDF、PPT 和 DOC 文件的文本
- 用户评论。用户可以对这些内容发表评论,我们希望了解是否有用户正在搜索相关信息
我想听听您对如何开发这样一个系统的建议。我们应该得到一个外部搜索系统,比如谷歌的,或者只是安装一个开源的,或者从头开始开发一个新的。
谢谢。
google-search-api - Google Search API - 结果数
每当您执行 Google 搜索时,它都会吐出一小段信息
“大约 8,110,000 个结果(0.10 秒)”
我正在使用某些术语返回的结果数量来对它们进行相互排名,所以如果我可以通过 API 获得这个整数 - 8,110,000 - 这将非常有帮助。一些 Google API 最近已被弃用,因此如果您能指出正确的未被弃用的 API,那将非常有帮助。
任何其他解决方法也将不胜感激。我看过一两篇关于类似主题的旧帖子,但似乎都没有成功解决。
java - Json:如何使用 java 从单个外部 Json 对象中提取内部 Json 对象
我有以下 Json 字符串,来自 google 搜索查询:
最外层(单个)标签是“responseData” 第一个(也是单个)嵌套标签是“results” 在“results”对象中,我有 2 个相同的网状数据集,每个代表一个完整的 google 搜索结果,其中包含我需要的元素,例如:“titleNoFormatting”、“addressLines”和“phoneNumbers”。
我正在编写我的第一个 Android java 应用程序,并且非常努力地提取我需要的值。我研究过 Gson 和 Jackson,但无法为自己想出解决方案。我认为,部分问题可能与一个事实有关,即这些内部数据集没有明确的容器名称,它们只是具有相同的结构:外部标签“结果”仅出现一次,并且包含两个相同的数据集。请任何人提供如何处理此问题的示例?