我正在尝试从 Google 查询中获取结果,在 Java 中如下所示:
String urlquery = "https://www.google.com/search?hl=en&gl=us&tbm=nws&q=apples&oq=apples";
URL url = new URL(urlquery);
URLConnection connection = url.openConnection();
URLConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5");
Run Code Online (Sandbox Code Playgroud)
但是,我不知道如何设置上面的“User-Agent”参数。我从哪里获得系统的值?我只是从网上找到的一些代码中复制了这些值。
我的系统配置如下: Mac OSX 10.8.3 Intel i7 Safari 6.0.3(8536.28.10)
特别营业时间在“Google 我的商家”上进行营销/记录,请参阅https://support.google.com/business/answer/6303076
有没有办法从 Google Places API 检索这个特殊开放时间?
我尝试过向“Google 我的商家”添加特殊营业时间。它在 Google 地图和 Google 搜索中按预期工作。但是,它不会显示在 Google Places API 的返回值中。
google-maps google-search google-places-api google-my-business-api
我从电子表格中提取大约 100,00 个值,并获取第一个结果以查看它们是 http 还是 https。这些脚本运行良好(对于我的目的而言足够好),但在循环的第 70 次迭代后我收到 503 错误。
关于如何获得我需要的查询量有什么想法/想法/建议吗?
代码:
import pandas as pd
import re
import time
library_list = pd.read_csv("PLS_FY2014_AE_pupld14a.csv")
zero = 0
with_https = 0
for i in library_list['LIBNAME']:
for url in search(library_list['LIBNAME'][zero], num = 1, start = 0, stop = 1):
time.sleep(5)
zero += 1
print(zero)
if 'https' in url:
with_https += 1
Run Code Online (Sandbox Code Playgroud) 一周前我已经公开了我的 Github 存储库,但即使我像site:https://github.com/user/reponame. Stackoverflow 上类似问题的答案建议通过链接https://www.google.com/webmasters/tools/submit-url将 repo 的 url 提供给 Google 搜索,但它不再起作用(我找到了文章https ://www.searchenginejournal.com/google-removes-public-url-submission-tool)。
如何让我的存储库 ( https://github.com/ZhenyaKh/replace-switches ) 对其他人可见?
github web-crawler google-search google-crawlers google-index
我遵循了https://support.google.com/webmasters/answer/9290858?hl=en上的 Favicon 指南。
然而,已经有一段时间了,mt favicon 还没有被索引 这里有一些线程,但没有显示任何不同的分辨率。
我的收藏夹图标为 .ico,但最近我将其更改为 .png。我还根据谷歌指南将其设置为 48x48。
任何帮助表示赞赏。
网站是http://veganthingsworld.com
<link rel="shortcut icon" type="image/icon" href="Images/favicon.png">
Run Code Online (Sandbox Code Playgroud)
提前致谢。
这是我的代码,在我使用它时没有收到错误之前它工作正常。我不明白这是怎么发生的,尽管我没有随之改变。:
results = []
for query in my_list:
results.append(search(query, tld="com", num=1, stop=1, pause=2))
Run Code Online (Sandbox Code Playgroud)
错误:
results.append(search(query, tld="com", num=1, stop=1, pause=2))
TypeError: search() got an unexpected keyword argument 'tld'
Run Code Online (Sandbox Code Playgroud) 我的一个朋友刚刚指出了一个有趣的现象......我去了谷歌主页并查看了源代码:
<!doctype html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Google</title>
...
...
...
A LOT OF STUFF HERE
...
...
...
</script>
Run Code Online (Sandbox Code Playgroud)
...所以我注意到源代码没有结束</body>和</html>标签.使用Chrome的Inspector,它会显示结束标记,但是当我右键单击并查看源代码时,它不在那里.
这里发生了什么?我错过了什么吗?我尝试使用W3C HTML Validator,它显示了一堆错误......
http://validator.w3.org/check?verbose=1&uri=http://www.google.com/
那么......这笔交易是什么?
我有以下代码(如下),并使用iGoogle版本.
$url = 'http://www.google.com/ig/calculator?hl=en&q=' . $amount . $from_Currency . '=?' . $to_Currency;
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('"', $rawdata);
$data = explode(' ', $data[3]);
$var = $data[0];
Run Code Online (Sandbox Code Playgroud)
但看了他们正在使用不同的URL:
'http://www.google.com/finance/converter?hl=en&a=' . $amount . '&from=' . $from_Currency . '&to=USD';
Run Code Online (Sandbox Code Playgroud)
但只是更改网址并不会返回我习惯的所需结果.
现在我得到的只是
http://www.w3.org/TR/html4/strict.dtd
Run Code Online (Sandbox Code Playgroud)
SO有任何人都在研究这个最新的货币转换器URL或有任何想法.或使用PHP替换
我想在Google搜索中添加公司联系人.我在Google的结构化数据测试工具中测试了以下代码,但它抛出了这个错误:
https://coda-resume.herokuapp.com/(提供的所有值http://www.example.com/必须具有相同的域.)
这是JSON-LD:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Organization",
"url": "https://coda-resume.herokuapp.com/",
"logo": "http://www.example.com/logo.png",
"contactPoint": [{
"@type": "ContactPoint",
"telephone": "+1-401-555-1212",
"contactType": "customer service"
}]
}
</script>
Run Code Online (Sandbox Code Playgroud)
(我把它放在head元素中.)
google-search ×10
html ×2
python ×2
favicon ×1
github ×1
google-index ×1
google-maps ×1
java ×1
json-ld ×1
php ×1
python-2.7 ×1
python-3.x ×1
schema.org ×1
validation ×1
w3c ×1
web-crawler ×1