SERP API Yandex查询参数
使用 Thordata的 SERP API 配置Yandex搜索查询,包括本土化、地理位置和分页等参数输出选项。
q,必填,
该参数定义了爬取时的搜索结果,默认值为q= pizza
。您可以输入任意您想要查询的关键词,也可以是任意语言。
代码示例:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://yandex.com/search?text=pizza^&json=1\"}"
本地化
yandex_domain,自选
指定要使用的 Yandex 域名(默认为 yandex.com
)。
可选值,如:
yandex.com
、yandex.ru
、yandex.com.tr
等其他地区域名
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{"url": "https://yandex.com.tr/search?text=pizza^&json=1"}"
hl,自选
控制搜索结果的界面语言(默认 en
)。
常见值:
en
(英语)
ru
(俄语)
es
(西班牙语)
完整语言代码列表:https://yandex.com/support/search/query-language.html
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{"url": "https://yandex.com/search?text=pizza^&json=1^&lang=de"}"
地理位置
lr,自选
指定搜索结果的地区(如 lr=Moscow
),优先级高于IP定位
格式:lr=<地区名称>
(如 lr=Moscow,Russia
)
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://yandex.com/search?text=pizza^&json=1^&lr=India\"}"
rstr,自选
双重过滤——强制结果匹配指定地区(lr
)或启用安全搜索
如:安全搜索:rstr=family
屏蔽成人内容
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://yandex.com/search?text=pizza^&json=1^&rstr=true\"}"
分页
p,自选
分页控制(从 p=0
开始),需配合每页条数参数使用。(如:text=pizza&p=2
# 获取第3页结果)
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://yandex.com/search?text=pizza^&json=1^&p=2\"}"curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://www.bing.com/search?q=pizza^&json=1^&first=10\"}"
within,自选
时间/范围限定,
时间范围:如 within=7d
(#仅显示7天内的结果)
域名限定:如 within=example.com
示例请求:
curl https://scraperapi.thordata.com/request -H "Content-Type: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxx" -d "{\"url\": \"https://yandex.com/search?text=pizza^&json=1^&within=2\"}"
如果您需要更多帮助,请通过邮箱support@thordata.com联系我们。