问题标签 [google-search]

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.

0 投票
1 回答
4161 浏览

google-search - Google 自定义搜索和 Opensearch

我的网站上有一个 Google 自定义搜索引擎,我最近实现了 opensearch XML 文件,这样我就可以在浏览器的搜索框中添加我们网站的搜索。

知道如何将自动完成/建议功能添加到浏览器的搜索框中吗?

0 投票
1 回答
1081 浏览

javascript - 使用 Google Image Search API 时出现奇怪的 javascript 错误

我正在尝试从此页面复制 Google 图片搜索。这是我的代码:

当我运行它时,我得到这个错误:

如果我通过加载搜索 API 时运行的回调到达该行,这怎么可能?谢谢阅读。

0 投票
1 回答
3961 浏览

google-search - 如何在我的应用程序中获取谷歌搜索结果?

我的页面中有一个文本框和一个按钮。在文本框中输入内容并按下按钮时,它应该转到谷歌服务器并收集所有搜索结果。怎么做?

我可以使用 Google AJAX 搜索 API,但不使用 api 就不能做这些事情吗?

0 投票
2 回答
18551 浏览

google-search - 使用 Google Cache 检索整个网站?

我想从谷歌缓存中检索一个有数千页的网站。有什么方法可以让我使用 Google Cache 或其他网络爬虫/归档器快速找回它?

0 投票
1 回答
1221 浏览

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...

  1. How come google.search.CurrentLocale returned valid string, where as the constructor google.search.CustomSearchControl() could not be loaded?

  2. 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!

0 投票
1 回答
439 浏览

javascript - js 强制页面进入 iframe - 谷歌会抓取它吗?

我有一个脚本,如果它不在我网站上的 iframe 中,它会重新加载博客页面。这会干扰搜索引擎抓取博客吗?

我的直觉说这个脚本不会阻止博客被抓取,但它会干扰搜索引擎生成的任何链接,因为这些链接会将用户与 js 转储到“顶级”的博客,而不是他们所追求的页面。要解决这个问题,需要一些花哨的 cookie 工作。

你说什么?

0 投票
1 回答
175 浏览

google-search - 确定 Google 网址是否为快速搜索

我有一个 URL 列表,我需要显示在其中执行的 Google 搜索词。问题是出现的一些谷歌搜索词只是来自谷歌搜索栏的请求,因此它可以显示其建议的下拉列表。我需要区分这些,但我不知道如何区分,因为我不了解 Google 的缩写请求参数。

我想在我自己动手做之前,我想问问是否有人知道如何区分它们。谢谢!

这是几个示例搜索。

从搜索栏:

http://www.google.com/webhp?hl=en&tab=iw#hl=en&client=hp&q=leonardo&aq=f&aqi=g10&aql=&oq=leonardo&gs_rfai=&fp=8631cdd35a4d476d

完整搜索:

http://www.google.com/search?hl=en&client=hp&q=leonardo&aq=f&aqi=g10&aql=&oq=leonardo&gs_rfai=&fp=8631cdd35a4d476d&tch=1&ech=1&psi=1idgTO3ODI6CsQPm5aH0DQ12813700709361

0 投票
1 回答
93 浏览

google-search - 谷歌如何发现 xyz.com 对特定类别有很好的反向链接

它如何找到网站的反向链接以及它是如何记住的。我听说过 robots.txt。

0 投票
1 回答
240 浏览

javascript - 如何在 Google 搜索中使用过滤器?

我已使用以下方法将文本框搜索转换为 Google 搜索:

但是,我想要网页搜索、图片搜索、本地搜索和新闻搜索的选项。

我有 :

如何使用上述相同的链接过滤此选项。

0 投票
2 回答
262 浏览

css - 我网站的 CSS 何时会影响我的搜索引擎排名?

起初,我认为 css 仅用于在用户在浏览器中查看文档时设置文档样式。但后来我意识到,搜索引擎在索引页面中也使用了 CSS。我相信搜索引擎不会将内容编入索引display: hidden,并且会严重惩罚使用关键字堆叠的网站(用户从未见过的文本,与背景颜色相同或出现在远离屏幕的位置)。

我的 2 个假设是否正确?搜索引擎还如何使用 CSS?会改变我的搜索引擎排名的 CSS 的具体例子会很棒。:D