yelp-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Yelp Search Integration

Yelp搜索集成

Search for local businesses on Yelp to find services, get contact information, check ratings, and retrieve hours of operation.
在Yelp上搜索本地商家,以查找服务、获取联系方式、查看评分及营业时间。

Setup

设置

1. Yelp API Key (Required)

1. Yelp API Key(必填)

  1. Go to https://www.yelp.com/developers
  2. Create an account or sign in
  3. Click "Create App" and fill out the form
  4. Copy your API Key
Add to your
.env
file:
YELP_API_KEY=your_api_key_here
  1. 访问https://www.yelp.com/developers
  2. 创建账户或登录
  3. 点击“Create App”并填写表单
  4. 复制你的API Key
将其添加到你的
.env
文件中:
YELP_API_KEY=your_api_key_here

2. Browser-Use for Reviews (Optional)

2. 浏览器用于评论提取(可选)

Only needed if you want to extract review text (slow, ~30-60s per request).
Install dependencies:
bash
uv add browser-use playwright langchain-openai
uv run playwright install chromium
Add to
.env
:
OPENAI_API_KEY=your_openai_key_here
Note: Review extraction uses browser-use to search DuckDuckGo (since Yelp blocks direct scraping). For most use cases, the rating + review_count from the API is sufficient.
仅当你需要提取评论文本时才需要(速度较慢,每次请求约30-60秒)。
安装依赖:
bash
uv add browser-use playwright langchain-openai
uv run playwright install chromium
添加到
.env
文件:
OPENAI_API_KEY=your_openai_key_here
注意:评论提取使用browser-use搜索DuckDuckGo(因为Yelp阻止直接爬取)。对于大多数使用场景,API提供的评分+评论数量已足够。

Scripts

脚本

All scripts are in
tools/yelp-search/scripts/
and should be run with
uv run python
.
所有脚本都位于
tools/yelp-search/scripts/
目录下,需使用
uv run python
运行。

search.py - Find Businesses (Primary Tool)

search.py - 查找商家(主工具)

bash
uv run python tools/yelp-search/scripts/search.py "search term" --location "City, State"
Options:
FlagDescriptionExample
--location
,
-l
City, address, or zip
"San Francisco"
or
"94123"
--latitude/--longitude
GPS coordinates
--latitude 37.78 --longitude -122.41
--limit
,
-n
Number of results (default: 5)
-n 10
--sort-by
Sort order
rating
,
distance
,
review_count
,
best_match
--price
Price filter (1-4)
--price 1,2
for $ and $$ only
--json
Output raw JSON
Examples:
bash
undefined
bash
uv run python tools/yelp-search/scripts/search.py "搜索关键词" --location "城市, 州"
选项:
标志描述示例
--location
,
-l
城市、地址或邮编
"San Francisco"
"94123"
--latitude/--longitude
GPS坐标
--latitude 37.78 --longitude -122.41
--limit
,
-n
结果数量(默认:5)
-n 10
--sort-by
排序方式
rating
,
distance
,
review_count
,
best_match
--price
价格筛选(1-4)
--price 1,2
仅显示$和$$的商家
--json
输出原始JSON数据
示例:
bash
undefined

Find top-rated dog groomers

查找评分最高的宠物美容店

uv run python tools/yelp-search/scripts/search.py "dog groomer" -l "San Francisco" --sort-by rating
uv run python tools/yelp-search/scripts/search.py "dog groomer" -l "San Francisco" --sort-by rating

Find cheap restaurants nearby

查找附近的平价餐厅

uv run python tools/yelp-search/scripts/search.py "restaurants" -l "94123" --price 1,2 --sort-by distance
uv run python tools/yelp-search/scripts/search.py "restaurants" -l "94123" --price 1,2 --sort-by distance

Search near a specific address

在特定地址附近搜索

uv run python tools/yelp-search/scripts/search.py "laundry pickup" -l "123 Main St, San Francisco"
undefined
uv run python tools/yelp-search/scripts/search.py "laundry pickup" -l "123 Main St, San Francisco"
undefined

details.py - Get Business Hours & Info

details.py - 获取商家营业时间及详细信息

bash
uv run python tools/yelp-search/scripts/details.py "business-alias"
The business alias is in the Yelp URL (e.g.,
the-laundry-corner-san-francisco
).
bash
uv run python tools/yelp-search/scripts/details.py "商家别名"
商家别名可在Yelp的URL中找到(例如:
the-laundry-corner-san-francisco
)。

phone_search.py - Reverse Lookup

phone_search.py - 反向电话号码查询

bash
uv run python tools/yelp-search/scripts/phone_search.py "+14155551234"
bash
uv run python tools/yelp-search/scripts/phone_search.py "+14155551234"

get_reviews.py - Extract Review Text (Slow)

get_reviews.py - 提取评论文本(速度慢)

bash
uv run python tools/yelp-search/scripts/get_reviews.py "Business Name" -l "City" -n 3
Note: Uses browser-use which is slow (~30-60s). Yelp blocks direct scraping, so it searches DuckDuckGo for cached reviews as a workaround.
bash
uv run python tools/yelp-search/scripts/get_reviews.py "商家名称" -l "城市" -n 3
注意: 使用browser-use,速度较慢(约30-60秒)。由于Yelp阻止直接爬取,因此通过搜索DuckDuckGo的缓存评论作为替代方案。

scrape_reviews.py - Direct Yelp Scraping (Alternative)

scrape_reviews.py - 直接爬取Yelp评论(替代方案)

bash
uv run python tools/yelp-search/scripts/scrape_reviews.py "https://www.yelp.com/biz/business-alias" -n 5
Requires Browserbase credentials:
BROWSERBASE_API_KEY=your_key_here
BROWSERBASE_PROJECT_ID=your_project_id
Note: Uses Browserbase with proxies to bypass Yelp's CAPTCHA. More reliable than
get_reviews.py
but requires a Browserbase account.
bash
uv run python tools/yelp-search/scripts/scrape_reviews.py "https://www.yelp.com/biz/business-alias" -n 5
需要Browserbase凭证:
BROWSERBASE_API_KEY=your_key_here
BROWSERBASE_PROJECT_ID=your_project_id
注意: 使用带代理的Browserbase绕过Yelp的验证码。比
get_reviews.py
更可靠,但需要Browserbase账户。

Best Practices

最佳实践

Evaluating Quality Without Review Text

无需评论文本评估商家质量

The API provides rating + review_count which is usually sufficient:
RatingReview CountInterpretation
4.5+50+Excellent, reliable data
4.5+<20Promising but limited data
4.0-4.4100+Good, well-established
<4.0anyProceed with caution
API提供的评分+评论数量通常已足够:
评分评论数量解读
4.5+50+优秀,数据可靠
4.5+<20前景良好,但数据有限
4.0-4.4100+良好,已建立口碑
<4.0任意谨慎选择

Finding Services with Specific Needs

寻找有特定需求的服务

When looking for services with specific requirements (weekend hours, pickup/delivery, etc.):
  1. Search with
    --sort-by rating
    to get best options
  2. Get details on top candidates to check hours
  3. Filter for businesses open when you need them
  4. Contact directly to confirm specific services (pickup, delivery, etc.) since Yelp doesn't always have this info
当寻找有特定要求的服务(周末营业、上门取送等)时:
  1. 搜索时使用
    --sort-by rating
    获取最佳选项
  2. 查看详情,检查候选商家的营业时间
  3. 筛选出符合你时间需求的商家
  4. 直接联系确认特定服务(上门取送等),因为Yelp并不总是包含此类信息

Search Tips

搜索技巧

  • Use specific terms:
    "laundry pickup"
    not just
    "laundry"
  • Search near an address for accurate distance:
    -l "123 Main St, City"
  • Sort by
    rating
    first, then check
    distance
    on results
  • Check
    review_count
    - high ratings with few reviews may be unreliable
  • 使用具体关键词:例如用
    "laundry pickup"
    而非仅
    "laundry"
  • 搜索时指定具体地址以获得准确的距离:
    -l "123 Main St, City"
  • 先按
    rating
    排序,再查看结果的
    distance
  • 查看
    review_count
    - 高评分但评论数量少的商家可能不可靠

Response Data

返回数据

Each business result includes:
  • name - Business name
  • phone - Phone number (use for texting/calling)
  • rating - Yelp rating (1-5 stars)
  • review_count - Number of reviews
  • price - Price level ($ to $$$$)
  • location - Full address
  • hours - Operating hours by day (in details)
  • distance - Distance from search location
  • categories - Business categories
  • is_open_now - Current open/closed status
每个商家结果包含:
  • name - 商家名称
  • phone - 电话号码(用于联系)
  • rating - Yelp评分(1-5星)
  • review_count - 评论数量
  • price - 价格等级($到$$$$)
  • location - 完整地址
  • hours - 按天划分的营业时间(在详情中)
  • distance - 与搜索地点的距离
  • categories - 商家类别
  • is_open_now - 当前营业状态

Limitations

限制

FeatureStatusNotes
Business search✅ WorksFast, reliable
Business details✅ WorksIncludes hours
Phone lookup✅ WorksReverse search
Review text (API)❌ Paid onlyRequires enterprise tier
Review text (scraping)⚠️ Slowbrowser-use workaround via DuckDuckGo
  • Free API tier: 500 calls/day
  • Results limited to 50 per request
  • Some business info (pickup/delivery) not in API - contact directly
功能状态说明
商家搜索✅ 可用快速、可靠
商家详情✅ 可用包含营业时间
电话号码查询✅ 可用反向搜索
评论文本(API)❌ 仅付费可用需要企业版
评论文本(爬取)⚠️ 速度慢通过browser-use借助DuckDuckGo实现的替代方案
  • 免费API层级:每天500次调用
  • 每次请求最多返回50条结果
  • 部分商家信息(上门取送等)未包含在API中 - 需直接联系商家确认