> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/sou-suo-yin-qing/gu-ge/l-xing-jiu-dian/jiu-dian-xiang-qing.md).

# 酒店详情

通过酒店页面链接，从 Google Travel 中抓取单个酒店的已解析详情和预订网站价格。

该 `google` 源自 `"parse": true` 可以返回单个 Google Travel 酒店页面的解析数据。将酒店页面链接作为 `url` 传入，以获取其详情、住客评分以及提供该酒店的预订网站。

{% hint style="info" %}
要先查找酒店，请使用 [**旅行：酒店**](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/sou-suo-yin-qing/gu-ge/l-xing-jiu-dian.md) 爬虫，它会返回酒店搜索结果。
{% endhint %}

## 获取酒店 URL

你可以通过两种方式获取酒店页面链接：

* `details_url` 来自 [旅行：酒店](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/sou-suo-yin-qing/gu-ge/l-xing-jiu-dian.md) 搜索结果。
* 使用 [旅行：酒店](https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/sou-suo-yin-qing/gu-ge/l-xing-jiu-dian.md) 返回的 `property_token` （例如 `https://www.google.com/travel/hotels/entity/<property_token>`)

## 请求示例

在此示例中，我们通过酒店的 Google Travel 页面链接发起请求，以获取该酒店的解析详情。

{% tabs %}
{% tab title="cURL" %}

```shell
curl 'https://data.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
        "source": "google",
        "url": "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE",
        "parse": true
    }'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
from pprint import pprint

# Structure payload.
payload = {
    'source': 'google',
    'url': 'https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE',
    'parse': True
}

# Get response.
response = requests.request(
    'POST',
    'https://data.oxylabs.io/v1/queries',
    auth=('USERNAME', 'PASSWORD'),
    json=payload,
)

# 将格式化后的响应打印到标准输出。
pprint(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const https = require("https");

const username = "USERNAME";
const password = "PASSWORD";
const body = {
    source: "google",
    url: "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE",
    parse: true,
};

const options = {
    hostname: "data.oxylabs.io",
    path: "/v1/queries",
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        Authorization:
            "Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
    },
};

const request = https.request(options, (response) => {
    let data = "";

    response.on("data", (chunk) => {
        data += chunk;
    });

    response.on("end", () => {
        const responseData = JSON.parse(data);
        console.log(JSON.stringify(responseData, null, 2));
    });
});

request.on("error", (error) => {
    console.error("Error:", error);
});

request.write(JSON.stringify(body));
request.end();
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$params = array(
    'source' => 'google',
    'url' => 'https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE',
    'parse' => true
);

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://data.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");


$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
echo $result;

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
    "bytes"
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

func main() {
    const Username = "USERNAME"
    const Password = "PASSWORD"

    payload := map[string]interface{}{
        "source": "google",
        "url":    "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE",
        "parse":  true,
    }

    jsonValue, _ := json.Marshal(payload)

    client := &http.Client{}
    request, _ := http.NewRequest("POST",
        "https://data.oxylabs.io/v1/queries",
        bytes.NewBuffer(jsonValue),
    )

    request.SetBasicAuth(Username, Password)
    response, _ := client.Do(request)

    responseText, _ := ioutil.ReadAll(response.Body)
    fmt.Println(string(responseText))
}
```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;

namespace OxyApi
{
    class Program
    {
        static async Task Main()
        {
            const string Username = "USERNAME";
            const string Password = "PASSWORD";

            var parameters = new {
                source = "google",
                url = "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE",
                parse = true
            };

            var client = new HttpClient();

            Uri baseUri = new Uri("https://data.oxylabs.io");
            client.BaseAddress = baseUri;

            var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
            requestMessage.Content = JsonContent.Create(parameters);

            var authenticationString = $"{Username}:{Password}";
            var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
            requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);

            var response = await client.SendAsync(requestMessage);
            var contents = await response.Content.ReadAsStringAsync();

            Console.WriteLine(contents);
        }
    }
}
```

{% endtab %}

{% tab title="Java" %}

```java
package org.example;

import okhttp3.*;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;

public class Main implements Runnable {
    private static final String AUTHORIZATION_HEADER = "Authorization";
    public static final String USERNAME = "USERNAME";
    public static final String PASSWORD = "PASSWORD";

    public void run() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("source", "google");
        jsonObject.put("url", "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE");
        jsonObject.put("parse", true);

        Authenticator authenticator = (route, response) -> {
            String credential = Credentials.basic(USERNAME, PASSWORD);
            return response
                    .request()
                    .newBuilder()
                    .header(AUTHORIZATION_HEADER, credential)
                    .build();
        };

        var client = new OkHttpClient.Builder()
                .authenticator(authenticator)
                .build();

        var mediaType = MediaType.parse("application/json; charset=utf-8");
        var body = RequestBody.create(jsonObject.toString(), mediaType);
        var request = new Request.Builder()
                .url("https://data.oxylabs.io/v1/queries")
                .post(body)
                .build();

        try (var response = client.newCall(request).execute()) {
            if (response.body() != null) {
                try (var responseBody = response.body()) {
                    System.out.println(responseBody.string());
                }
            }
        } catch (Exception exception) {
            System.out.println("Error: " + exception.getMessage());
        }

        System.exit(0);
    }

    public static void main(String[] args) {
        new Thread(new Main()).start();
    }
}
```

{% endtab %}

{% tab title="JSON" %}

```json
{
    "source": "google",
    "url": "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE",
    "parse": true
}
```

{% endtab %}
{% endtabs %}

我们使用 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 集成方式在示例中。提交任务后会立即返回任务 ID，而不是结果。一旦任务状态为 `完成`，请使用以下方式获取结果： `GET https://data.oxylabs.io/v1/queries/{job_id}/results`。请参阅 [**Push-Pull**](https://developers.oxylabs.io/products/cn/web-scraper-api/integration-methods/push-pull.md) 以了解如何检查任务状态、回调和批量查询。

## 请求参数

<table><thead><tr><th width="164">参数</th><th width="471.3333333333333">说明</th><th width="116">默认值</th></tr></thead><tbody><tr><td><mark style="background-color:green;"><strong><code>source</code></strong></mark></td><td>设置抓取器。使用 <code>google</code>.</td><td>–</td></tr><tr><td><mark style="background-color:green;"><strong><code>url</code></strong></mark></td><td>Google Travel 酒店页面链接，例如 <code>https://www.google.com/travel/hotels/entity/&#x3C;property_token></code>。请参阅 <strong>获取酒店 URL</strong>.</td><td>–</td></tr><tr><td><mark style="background-color:green;"><strong><code>parse</code></strong></mark></td><td>设置为时返回解析后的数据 <code>true</code>。需要接收在以下内容中描述的结构化输出： <strong>输出字典</strong>.</td><td><code>false</code></td></tr><tr><td><code>render</code></td><td>设置为时启用 JavaScript 渲染 <code>html</code>. <strong>更多信息。</strong></td><td>–</td></tr><tr><td><code>callback_url</code></td><td>回调端点的 URL。 <strong>更多信息。</strong></td><td>–</td></tr><tr><td><code>user_agent_type</code></td><td>设备类型和浏览器。完整列表可见 <strong>这里</strong>.</td><td><code>桌面端</code></td></tr></tbody></table>

&#x20;   \- 必填参数

## 结构化数据

网页爬虫API 可以提取结果 HTML 或 JSON 响应，其中包含酒店页面各个元素的结构化数据。

<details>

<summary>结构化输出（JSON）</summary>

```json
{
    "results": [
        {
            "content": {
                "parse_status_code": 12000,
                "results": {
                    "address": "17 Bd Morland, 75004 Paris, France",
                    "coordinates": [
                        48.8501611,
                        2.3628378999999997
                    ],
                    "fid": "0x47e671f93cda1a8d:0x651a57f6d128211c",
                    "name": "The People",
                    "overview": {
                        "address": "17 Bd Morland, 75004 Paris, France",
                        "available": true,
                        "coordinates": {
                            "latitude": 48.8501611,
                            "longitude": 2.3628378999999997
                        },
                        "currency": "USD",
                        "fid": "0x47e671f93cda1a8d:0x651a57f6d128211c",
                        "phone": "+33 1 81 22 40 88",
                        "requested": {
                            "end_date": "2026-11-06",
                            "start_date": "2026-11-05"
                        },
                        "reviews_ratings": {
                            "rating": 4,
                            "reviews_by_stars": {
                                "1": "11%",
                                "2": "6%",
                                "3": "9%",
                                "4": "18%",
                                "5": "56%"
                            },
                            "reviews_cnt": 1953
                        },
                        "title": "The People"
                    },
                    "phone": "+33 1 81 22 40 88",
                    "prices": [
                        {
                            "cost": {
                                "currency": "USD",
                                "value": 85
                            },
                            "link": "https://www.google.com/travel/lodging/clk?pc=AJ0xEygFmf7LObgt...&pcurl=https://secure-hotel-tracker.com/gha/landing.php?...",
                            "logo": "https://www.gstatic.com/travel-hotels/branding/icon_default.png",
                            "price": {
                                "currency": "USD",
                                "value": 85
                            },
                            "title": "The People"
                        },
                        {
                            "cost": {
                                "currency": "USD",
                                "value": 94
                            },
                            "link": "https://www.google.com/travel/lodging/clk?pc=AJ0xEyixW2JiNEf2...&pcurl=https://www.booking.com/searchresults.en.html?...",
                            "logo": "https://www.gstatic.com/travel-hotels/branding/icon_184.png",
                            "price": {
                                "currency": "USD",
                                "value": 94
                            },
                            "title": "Booking.com"
                        },
                        {
                            "cost": {
                                "currency": "USD",
                                "value": 247
                            },
                            "link": "https://www.google.com/travel/lodging/clk?pc=AJ0xEyjXiM8NBzfe...&pcurl=https://www.expedia.com/Hotel-Search?...",
                            "logo": "https://www.gstatic.com/travel-hotels/branding/ac238c97-1652-4830-8da8-bb8d8883af88.png",
                            "price": {
                                "currency": "USD",
                                "value": 247
                            },
                            "title": "Expedia.com"
                        }
                    ]
                },
                "url": "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE"
            },
            "created_at": "2026-11-04 11:10:11",
            "is_render_forced": false,
            "job_id": "7523703137538935809",
            "page": 1,
            "parser_preset": null,
            "parser_type": "google_travel_hotel_entity",
            "status_code": 200,
            "type": "parsed",
            "updated_at": "2026-11-04 11:10:18",
            "url": "https://www.google.com/travel/hotels/entity/ChkInMKgie3-lY1lGg0vZy8xMXJ0X3M0dno0EAE"
        }
    ]
}
```

</details>

### 输出字典

下表列出了我们解析的每个顶层元素的详细列表，以及其说明和数据类型。

{% hint style="info" %}
某些字段可能因酒店及其可用数据而异。
{% endhint %}

<table data-full-width="false"><thead><tr><th width="275">键</th><th width="385">说明</th><th width="106">类型</th></tr></thead><tbody><tr><td><code>url</code></td><td>Google Travel 酒店详情页面的 URL。</td><td>字符串</td></tr><tr><td><code>parse_status_code</code></td><td>解析任务的状态码。了解更多 <strong>这里</strong>.</td><td>整数</td></tr><tr><td><code>results.name</code></td><td>酒店名称。</td><td>字符串</td></tr><tr><td><code>results.address</code></td><td>酒店的完整街道地址。</td><td>字符串</td></tr><tr><td><code>results.phone</code></td><td>酒店电话号码。</td><td>字符串</td></tr><tr><td><code>results.coordinates</code></td><td>酒店位置，格式为 <code>[latitude, longitude]</code>.</td><td>数组</td></tr><tr><td><code>results.fid</code></td><td>Google 为该酒店提供的唯一地点标识符。</td><td>字符串</td></tr><tr><td><code>results.overview</code></td><td>酒店及所请求入住的概览信息。包括 <code>available</code>, <code>currency</code>, <code>requested</code>, <code>reviews_ratings</code>.</td><td>对象</td></tr><tr><td><code>results.overview.available</code></td><td>酒店是否有所请求日期的可用房间。</td><td>布尔值</td></tr><tr><td><code>results.overview.currency</code></td><td>响应中所有价格的货币。</td><td>字符串</td></tr><tr><td><code>results.overview.requested</code></td><td>价格适用的入住日期。包括 <code>start_date</code>, <code>end_date</code>.</td><td>对象</td></tr><tr><td><code>results.overview.reviews_ratings</code></td><td>住客评分摘要。包括 <code>rating</code> （总体评分，例如 <code>4.5</code>), <code>reviews_cnt</code> （评论总数）， <code>reviews_by_stars</code> （按 1–5 星的评论占比）。</td><td>对象</td></tr><tr><td><code>results.prices</code></td><td>提供该酒店的预订网站列表。包括 <code>title</code> （预订网站名称）， <code>price</code> （每晚价格： <code>value</code>, <code>currency</code>), <code>cost</code> （整个入住期间的总价： <code>value</code>, <code>currency</code>), <code>link</code> （重定向到预订网站的报价）。</td><td>数组</td></tr><tr><td><code>results.additional_results</code></td><td>提供该酒店但未显示价格的预订网站列表。包括 <code>title</code> （预订网站名称）， <code>link</code> （重定向到预订网站）。</td><td>数组</td></tr><tr><td><code>created_at</code></td><td>爬取任务创建时的时间戳。</td><td>时间戳</td></tr><tr><td><code>updated_at</code></td><td>爬取任务完成时的时间戳。</td><td>时间戳</td></tr><tr><td><code>job_id</code></td><td>与爬取任务关联的任务 ID。</td><td>字符串</td></tr><tr><td><code>status_code</code></td><td>爬取任务的状态码。了解更多 <strong>这里</strong>.</td><td>整数</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.oxylabs.io/products/cn/web-scraper-api/mu-biao/sou-suo-yin-qing/gu-ge/l-xing-jiu-dian/jiu-dian-xiang-qing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
