跳转到主要内容
POST
https://api.aisa.one/apis/v1
/
dataforseo
/
business_data
/
google
/
hotel_searches
/
live
实时 Google 酒店搜索任务
curl --request POST \
  --url https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "location_name": "<string>",
  "location_code": 123,
  "location_coordinate": "<string>",
  "language_name": "<string>",
  "language_code": "<string>",
  "keyword": "<string>",
  "depth": 123,
  "check_in": "<string>",
  "check_out": "<string>",
  "currency": "<string>",
  "adults": 123,
  "children": [
    "<string>"
  ],
  "stars": [
    "<string>"
  ],
  "min_rating": 123,
  "sort_by": "<string>",
  "min_price": 123,
  "max_price": 123,
  "free_cancellation": true,
  "is_vacation_rentals": true,
  "amenities": [
    "<string>"
  ],
  "tag": "<string>"
}
'
import requests

url = "https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live"

payload = {
"location_name": "<string>",
"location_code": 123,
"location_coordinate": "<string>",
"language_name": "<string>",
"language_code": "<string>",
"keyword": "<string>",
"depth": 123,
"check_in": "<string>",
"check_out": "<string>",
"currency": "<string>",
"adults": 123,
"children": ["<string>"],
"stars": ["<string>"],
"min_rating": 123,
"sort_by": "<string>",
"min_price": 123,
"max_price": 123,
"free_cancellation": True,
"is_vacation_rentals": True,
"amenities": ["<string>"],
"tag": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
location_name: '<string>',
location_code: 123,
location_coordinate: '<string>',
language_name: '<string>',
language_code: '<string>',
keyword: '<string>',
depth: 123,
check_in: '<string>',
check_out: '<string>',
currency: '<string>',
adults: 123,
children: ['<string>'],
stars: ['<string>'],
min_rating: 123,
sort_by: '<string>',
min_price: 123,
max_price: 123,
free_cancellation: true,
is_vacation_rentals: true,
amenities: ['<string>'],
tag: '<string>'
})
};

fetch('https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'location_name' => '<string>',
'location_code' => 123,
'location_coordinate' => '<string>',
'language_name' => '<string>',
'language_code' => '<string>',
'keyword' => '<string>',
'depth' => 123,
'check_in' => '<string>',
'check_out' => '<string>',
'currency' => '<string>',
'adults' => 123,
'children' => [
'<string>'
],
'stars' => [
'<string>'
],
'min_rating' => 123,
'sort_by' => '<string>',
'min_price' => 123,
'max_price' => 123,
'free_cancellation' => true,
'is_vacation_rentals' => true,
'amenities' => [
'<string>'
],
'tag' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live"

payload := strings.NewReader("{\n \"location_name\": \"<string>\",\n \"location_code\": 123,\n \"location_coordinate\": \"<string>\",\n \"language_name\": \"<string>\",\n \"language_code\": \"<string>\",\n \"keyword\": \"<string>\",\n \"depth\": 123,\n \"check_in\": \"<string>\",\n \"check_out\": \"<string>\",\n \"currency\": \"<string>\",\n \"adults\": 123,\n \"children\": [\n \"<string>\"\n ],\n \"stars\": [\n \"<string>\"\n ],\n \"min_rating\": 123,\n \"sort_by\": \"<string>\",\n \"min_price\": 123,\n \"max_price\": 123,\n \"free_cancellation\": true,\n \"is_vacation_rentals\": true,\n \"amenities\": [\n \"<string>\"\n ],\n \"tag\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"location_name\": \"<string>\",\n \"location_code\": 123,\n \"location_coordinate\": \"<string>\",\n \"language_name\": \"<string>\",\n \"language_code\": \"<string>\",\n \"keyword\": \"<string>\",\n \"depth\": 123,\n \"check_in\": \"<string>\",\n \"check_out\": \"<string>\",\n \"currency\": \"<string>\",\n \"adults\": 123,\n \"children\": [\n \"<string>\"\n ],\n \"stars\": [\n \"<string>\"\n ],\n \"min_rating\": 123,\n \"sort_by\": \"<string>\",\n \"min_price\": 123,\n \"max_price\": 123,\n \"free_cancellation\": true,\n \"is_vacation_rentals\": true,\n \"amenities\": [\n \"<string>\"\n ],\n \"tag\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.aisa.one/apis/v1/dataforseo/business_data/google/hotel_searches/live")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"location_name\": \"<string>\",\n \"location_code\": 123,\n \"location_coordinate\": \"<string>\",\n \"language_name\": \"<string>\",\n \"language_code\": \"<string>\",\n \"keyword\": \"<string>\",\n \"depth\": 123,\n \"check_in\": \"<string>\",\n \"check_out\": \"<string>\",\n \"currency\": \"<string>\",\n \"adults\": 123,\n \"children\": [\n \"<string>\"\n ],\n \"stars\": [\n \"<string>\"\n ],\n \"min_rating\": 123,\n \"sort_by\": \"<string>\",\n \"min_price\": 123,\n \"max_price\": 123,\n \"free_cancellation\": true,\n \"is_vacation_rentals\": true,\n \"amenities\": [\n \"<string>\"\n ],\n \"tag\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "version": "<string>",
  "version.status_code": 123,
  "version.status_message": "<string>",
  "version.time": "<string>",
  "version.cost": 123,
  "version.tasks_count": 123,
  "version.tasks_error": 123,
  "tasks": [
    "<string>"
  ],
  "tasks.id": "<string>",
  "tasks.status_code": 123,
  "tasks.status_message": "<string>",
  "tasks.time": "<string>",
  "tasks.cost": 123,
  "tasks.result_count": 123,
  "tasks.path": [
    "<string>"
  ],
  "tasks.data": {},
  "result": [
    "<string>"
  ],
  "result.keyword": "<string>",
  "result.location_code": 123,
  "result.language_code": "<string>",
  "result.check_url": "<string>",
  "result.datetime": "<string>",
  "result.items_count": 123,
  "items": [
    "<string>"
  ],
  "items.type": "<string>",
  "items.hotel_identifier": "<string>",
  "items.title": "<string>",
  "items.stars": 123,
  "items.is_paid": true,
  "items.location": {},
  "items.latitude": 123,
  "items.longitude": 123,
  "items.reviews": {},
  "items.value": 123,
  "items.votes_count": 123,
  "items.mentions": [
    "<string>"
  ],
  "items.rating_distribution": {},
  "items.other_sites_reviews": [
    "<string>"
  ],
  "items.overview_images": [
    "<string>"
  ],
  "items.prices": {},
  "items.price": 123,
  "items.price_without_discount": 123,
  "items.currency": "<string>",
  "items.discount_text": "<string>",
  "items.check_in": "<string>",
  "items.check_out": "<string>",
  "items.visitors": 123,
  "items.items": [
    "<string>"
  ]
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
location_name
string
必填

搜索引擎位置的完整名称如果未指定 location_codelocation_coordinate,则为必填字段如果使用此字段,则无需指定 location_codelocation_coordinate。可以通过向 https://api.dataforseo.com/v3/business_data/google/locations 单独发起请求,获取包含 location_name 的可用位置列表。示例:London,England,United Kingdom注意:为获得准确的搜索结果,您指定的 location_name 将自动附加到关键词中

location_code
integer
必填

搜索引擎位置代码 如果未指定 location_namelocation_coordinate,则为必填字段 如果使用此字段,则无需指定 location_namelocation_coordinate 可通过向 https://api.dataforseo.com/v3/business_data/google/locations 单独发送请求,获取包含 location_code 的可用位置列表。示例:2840

location_coordinate
string
必填

位置的 GPS 坐标 如果未指定 location_namelocation_code,则此字段为必填字段 如果使用此字段,则无需指定 location_namelocation_code location_coordinate 参数应采用 “纬度,经度” 格式 “纬度”“经度” 的最大小数位数:7 注意:如果使用坐标设置位置,搜索将在最近的居民点进行 示例:53.476225,-2.243572

language_name
string
必填

搜索引擎语言的完整名称 如果未指定 language_code,则为必填字段 如果使用此字段,则无需指定 language_code 您可以通过向 https://api.dataforseo.com/v3/business_data/google/languages 单独发送请求,获取包含 language_name 的可用语言列表。示例:English

language_code
string
必填

搜索引擎语言代码 如果未指定 language_name,则为必填字段 如果使用此字段,则无需指定 language_name 可通过向 https://api.dataforseo.com/v3/business_data/google/languages 单独发送请求,获取可用语言及其 language_code 的列表 示例:en

keyword
string

keyword 可选字段,您指定的关键词用于搜索酒店列表;如果不使用此字段,我们将返回在指定位置找到的酒店列表;您可以在 keyword 字段中指定最多 700 个字符所有 %## 都将被解码(加号字符“+”将被解码为空格字符);如果需要在 keyword 中使用“%”字符,请将其指定为“%25”;注意:为获得准确的搜索结果,位置名称会自动附加到关键词中。有关 DataForSEO API 中 keywordkeywords 字段的规则与限制,请参阅这篇帮助中心文章

depth
integer

解析深度 可选字段 Google Hotels 中的结果数量 默认值:20 条自然搜索结果 最大值:140 注意:无论响应中是否包含付费列表,您的账户都将按每 20 条自然搜索结果计费;因此,如果 Google Hotels 返回超过 20 条结果,将深度设置为高于 20 可能产生额外费用;如果指定的深度高于响应中的结果数量,差额将自动退还至您的账户余额

check_in
string

入住日期 可选字段 如果未指定此字段,默认使用明天的日期;日期格式:"yyyy-mm-dd" 示例:"2019-01-15" 注意:该值不能早于今天的日期

check_out
string

退房日期;可选字段;如果未指定此字段,系统将默认使用从现在起两天后的日期;日期格式:"yyyy-mm-dd";示例:"2019-01-15"注意:该值不能小于或等于 check_incheck_incheck_out 值之间的范围不能超过 30 天

currency
string

货币 可选字段示例:"USD"

adults
integer

成人人数,可选字段;如果未指定此字段,将应用默认值 2注意,成人和儿童合计最多可指定 6 人;示例:1

children
string[]

儿童人数和年龄。可选字段。如果不指定此字段,搜索中将不包含儿童;儿童年龄范围为 017注意,成人和儿童合计最多可指定 6 人。如果要包含一名 14 岁儿童,请设置以下值:[14];如果要包含一名 13 岁儿童和一名 8 岁儿童,请设置以下值:[13,8]

stars
string[]

酒店星级 可选字段;如果只想获取五星级酒店列表,请将此字段设置为 [5],例如:[3,4,5]

min_rating
number

最低评分 可选字段;您可以使用此字段指定高于某个值的住客评分,例如:2.5

sort_by
string

结果排序参数 可选字段。您可以使用此字段对结果进行排序。可选排序类型:relevance – 按相关性从高到低排序;lowest_price – 按价格从低到高排序;highest_rating – 按评分从高到低排序;most_reviewed – 按评论数量从多到少排序。默认值:relevance

min_price
integer

每晚最低价格 可选字段,此值的货币取决于 currency 字段;示例:100

max_price
integer

每晚最高价格 可选字段,此值的货币取决于 currency 字段,例如:600

free_cancellation
boolean

可免费取消的酒店,可选字段。如果希望获取可免费取消预订的酒店列表,请将此字段设置为 true。默认值:false

is_vacation_rentals
boolean

搜索度假租赁住宿 可选字段;如果希望获取度假租赁住宿列表而非酒店列表,请将此字段设置为 true;默认值:false

amenities
string[]

酒店设施。可选字段。可使用此字段指定不同的酒店设施。示例:[ "free_parking", "pets_allowed" ]。可用值:"air_conditioning","all_inclusive_available","bar","free_breakfast","fitness_center","kid_friendly","free_parking","pets_allowed","pool","restaurant","room_service","spa","free_wifi","parking","indoor_pool","outdoor_pool","wheelchair_accessible","beach_access"

tag
string

用户定义的任务标识符,可选字段,字符数上限为 255。你可以使用此参数标识任务并将其与结果匹配;你可以在响应的 data 对象中找到指定的 tag

响应

成功响应

version
string

API 的当前版本

version.status_code
integer

常规状态代码 您可以在此处查看完整的响应代码列表。注意:我们强烈建议设计必要的系统来处理相关异常或错误情况

version.status_message
string

一般信息消息 你可以在此处查看一般信息消息的完整列表

version.time
string

执行时间(秒)

version.cost
number

任务总成本(美元)

version.tasks_count
integer

tasks数组中的任务数量

version.tasks_error
integer

返回的 tasks 数组中发生错误的任务数量

tasks
string[]

任务数组

tasks.id
string

我们系统中的唯一任务标识符,采用通用唯一标识符 (UUID) 格式

tasks.status_code
integer

DataForSEO 生成的任务状态码;取值范围为:10000-60000

tasks.status_message
string

任务信息消息

tasks.time
string

执行时间(秒)

tasks.cost
number

任务成本(美元)

tasks.result_count
integer

result 数组中的元素数量

tasks.path
string[]

URL 路径

tasks.data
object

包含与您在 POST 请求中指定的参数相同的参数

result
string[]

结果数组

result.keyword
string

在 POST 数组中接收的 keyword 返回的 keyword 会对 %## 进行解码(加号字符“+”将被解码为空格字符)

result.location_code
integer

POST 数组中的位置代码

result.language_code
string

POST 数组中的语言代码

result.check_url
string

搜索引擎结果的直接 URL,你可以使用它确认我们提供的结果是否准确

result.datetime
string

收到结果的日期和时间,采用 UTC 格式:“yyyy-mm-dd hh-mm-ss +00:00”;示例:2019-11-15 12:57:46 +00:00

result.items_count
integer

项目类型 items 数组中的项目数量

items
string[]

出现的项目类型 items 数组中出现的搜索引擎结果类型;可能的项目类型:hotel_search_item

items.type
string

元素类型 = ‘hotel_search_item’

items.hotel_identifier
string

Google 搜索中酒店实体的唯一标识符 示例:CgoI-KWyzenM_MV3EAE

items.title
string

酒店名称

items.stars
integer

酒店星级评分 范围为 1–5 星的星级评分

items.is_paid
boolean

表示付费酒店列表 如果为 true,相关 hotel_search_item 为付费广告;如果为 false,相关 hotel_search_item 为自然酒店列表

items.location
object

酒店位置的 GPS 坐标

items.latitude
number

酒店在 google maps 中的纬度坐标 示例:"latitude": 51.584091

items.longitude
number

酒店在 Google Maps 中的经度坐标 示例:"longitude": -0.31365919999999997

items.reviews
object

酒店评论和评分信息

items.value
number

基于所有评论的平均评分

items.votes_count
integer

投票数

items.mentions
string[]

酒店提及信息 注意:此字段始终等于 null;可使用此字段简化集成,并确保与 Hotel Info 端点的互操作性

items.rating_distribution
object

按投票统计的评分分布 注意: 此字段始终等于 null;使用此字段可简化集成,并确保与 酒店信息 端点的互操作性

items.other_sites_reviews
string[]

第三方网站上的评价 注意:此字段始终等于 null;使用此字段可简化集成,并确保与 Hotel Info 端点的互操作性

items.overview_images
string[]

酒店的精选图片

items.prices
object

酒店价格

items.price
integer

每晚价格

items.price_without_discount
integer

未应用折扣的每晚全价

items.currency
string

除非在 POST 数组中指定,否则默认采用价格货币 USD

items.discount_text
string

有关已应用折扣的文本

items.check_in
string

UTC 格式的入住日期和时间:“yyyy-mm-dd hh-mm-ss +00:00”,示例:2019-11-15 12:57:46 +00:00

items.check_out
string

UTC 格式的退房日期和时间:“yyyy-mm-dd hh-mm-ss +00:00”,示例:2019-11-15 12:57:46 +00:00

items.visitors
integer

此价格对应的酒店访客人数

items.items
string[]

项目数组 注意:此字段始终等于 null;使用此字段可简化集成,并确保与 Hotel Info 端点的互操作性