You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Places API查手机号返回ZERO_RESULTS但Maps有结果的问题

Google Places API查询手机号返回ZERO_RESULTS与手动搜索不一致的解决方法

我正在用Python结合Google Places API开发手机号校验工具,用来查询手机号是否在Google Maps上注册,但发现API返回结果和手动搜索不一致(所在地区:韩国)。

手动在Google Maps搜索手机号「070-4596-3690」能得到1条结果,但调用Places API时返回「ZERO_RESULTS」。尝试过添加location_bias参数、改用textquery类型查询都没用,求正确解决方法。

原代码如下:

import json
import googlemaps
from googlemaps.places import find_place

api_key = 'API_KEY'

client = googlemaps.Client(key=api_key)

response = find_place(
    client,
    '+827045963690',
    'phonenumber', # 'textquery' also return ZERO_RESULTS
    ['place_id',],
    
    # 'location_bias' was not helpful
    # location_bias='circle:100000@35.5373332,128.1012428'
    # location_bias='rectangle:32.967717951112654,125.60777420336103|38.75028515307909,129.65074281706745'
    # location_bias='rectangle:37.2814481,127.0967687|37.2918108,127.107755'
)

print(json.dumps(response, indent=4, ensure_ascii=False))
'''
{
    "candidates": [],
    "status": "ZERO_RESULTS"
}
'''

可能原因与解决方法

1. 换用Places Text Search API

find_place方法侧重精准匹配,而手动搜索的逻辑更接近Text Search的模糊匹配,后者更容易返回关联结果。示例代码:

import json
import googlemaps

api_key = 'API_KEY'
client = googlemaps.Client(key=api_key)

# 直接搜索带格式的本地手机号,同时指定目标位置缩小范围
response = client.places_text_search(
    query='070-4596-3690',
    location=(37.2833789, 127.1017312),
    radius=1000
)
print(json.dumps(response, indent=4, ensure_ascii=False))

2. 验证API权限与计费状态

确保你的Google Cloud项目已启用Places API,并且计费账号状态正常——部分地区的商家信息仅对已启用计费的开放,同时检查是否有API调用超限的情况。

3. 尝试多种手机号格式

API对不同格式的手机号匹配度可能不同,建议测试以下几种格式:

  • 本地带连字符:070-4596-3690
  • 国际无连字符:+827045963690
  • 本地无连字符:07045963690

4. 用Place Details API反向验证

从手动搜索的结果中提取Place ID(ChIJze0aU7uifDURQe2b5948557),直接查询该地点的手机号信息,确认数据是否已同步到API:

response = client.place(
    place_id='ChIJze0aU7uifDURQe2b5948557',
    fields=['formatted_phone_number', 'international_phone_number']
)
print(json.dumps(response, indent=4, ensure_ascii=False))

内容的提问来源于stack exchange,提问作者sssbbbaaa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.23 16:52:45