您也可以尝试传递uule
参数,即加密的 Google 位置参数。
例如w+CAIQICIaQXVzdGluLFRleGFzLFVuaXRlZCBTdGF0ZXM
(奥斯汀,德克萨斯州,美国)
您可以在此处阅读更多相关信息:https ://blog.linkody.com/seo-local/uule-2
或者,您可以使用第三方解决方案,例如 SerpApi。这是一个免费试用的付费 API。
示例 php 代码(也可在其他库中获得):
require 'path/to/google_search_results';
$query = [
"api_key" => "secret_api_key",
"engine" => "google",
"q" => "coffee",
"location" => "Austin, Texas, United States",
"google_domain" => "google.com",
"gl" => "us",
"hl" => "en",
"tbm" => "shop"
];
$search = new GoogleSearch();
$results = $search->json($query);
示例 JSON 输出:
"inline_shopping_results": [
{
"position": 1,
"block_position": "top",
"title": "Hazelnut & French Vanilla Bundle (30% Off) 12 oz Beans",
"price": "$47.95",
"extracted_price": 47.95,
"link": "https://www.google.com/aclk?sa=l&ai=DChcSEwjO8tWjiabxAhUDU3IKHUrrC5cYABAEGgJxdQ&sig=AOD64_3Ui55ttgZqIqcfG24uwghjpEXZ3w&ctype=5&q=&ved=0ahUKEwjI49CjiabxAhUCVc0KHbKhD-4Qww8I9Qo&adurl=",
"source": "lifeboostcoffee.com",
"shipping": "Free shipping",
"thumbnail": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQNspCBgGMVst_bukmSUPgfCrhshOZOkMMFaIVsJjlcr6P5RR7QfwcGiLzBc1jiKq_LzbgwhM2ZSjqc9p3Tr4h1KjgMbTccri-v6uIXamyMCjrMONPdN0DWyg&usqp=CAE"
},
...
],
"shopping_results": [
{
"position": 1,
"title": "Black Rifle Coffee Company Freedom Fuel Coffee Roast 12oz. Ground4.01Ground · Dark Roast · Bag",
"link": "https://www.google.com/aclk?sa=L&ai=DChcSEwjO8tWjiabxAhUDU3IKHUrrC5cYABA2GgJxdQ&sig=AOD64_2h8ptBTClONQYS9yOHV7RdLQjwbw&ctype=5&q=&ved=0ahUKEwjI49CjiabxAhUCVc0KHbKhD-4Qg-UECN8L&adurl=",
"product_link": "https://google.com/shopping/product/18134019833504388210",
"product_id": "18134019833504388210",
"serpapi_product_api": "https://serpapi.com/search.json?device=desktop&engine=google_product&gl=us&google_domain=google.com&hl=en&location=Austin%2C+Texas%2C+United+States&product_id=18134019833504388210",
"source": "Black Rifle Coffee Company",
"price": "$13.99",
"extracted_price": 13.99,
"rating": 4,
"reviews": 1,
"snippet": "Ground · Dark Roast · Bag",
"thumbnail": "https://serpapi.com/searches/60cf21bbea1442598e2972d1/images/c54459381b000cca098e49139db83d19bde8b72d3bef4a5544e7fad26ff7169d.webp"
},
...
]
查看文档以获取更多详细信息。
免责声明:我在 SerpApi 工作。