Booking Hotel
将 Booking.com 酒店页面解析为结构化 JSON,包含名称、描述、地址、坐标、星级评定、评论分数、评论数、评论标签、图片以及设施。
API 用法
在 Crawling API 请求中添加 &scraper=booking-hotel。在 url 参数中对目标 URL 进行 URL 编码。
curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
--data-urlencode 'url=https://www.booking.com/hotel/nl/example-amsterdam.html' \
--data-urlencode 'scraper=booking-hotel' -Gfrom crawlbase import CrawlingAPI
api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
'https://www.booking.com/hotel/nl/example-amsterdam.html',
{'scraper': 'booking-hotel'}
)
import json
data = json.loads(res['body'])const { CrawlingAPI } = require('crawlbase');
const api = new CrawlingAPI({ token: 'YOUR_TOKEN' });
const res = await api.get(
'https://www.booking.com/hotel/nl/example-amsterdam.html',
{ scraper: 'booking-hotel' }
);
const data = JSON.parse(res.body);require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')
res = api.get('https://www.booking.com/hotel/nl/example-amsterdam.html', scraper: 'booking-hotel')
data = JSON.parse(res.body)示例输入 URL
传入 url 参数的 URL(为便于阅读已 URL 解码):
https://www.booking.com/hotel/nl/example-amsterdam.html响应结构
JSON 响应体。当源页面省略对应值时,字段类型可能为 null。
酒店名称。
酒店的规范 Booking.com URL。
完整的酒店描述。
酒店地址。
酒店的地理坐标。
酒店的纬度,若不可用则为 null。
酒店的经度,若不可用则为 null。
酒店的星级评定,若未评定则为 null。
平均评论分数,若无评论则为 null。
评论数量,若无评论则为 null。
文本型评论标签(例如
Superb),如存在。主图片 URL(如存在)。
酒店提供的设施名称。
示例响应
{
"name": "Canal House Amsterdam",
"url": "https://www.booking.com/hotel/nl/example-amsterdam.html",
"description": "A restored 17th-century canal house in the heart of Amsterdam, steps from the Jordaan district. Rooms overlook the Keizersgracht with original beamed ceilings and a private garden terrace.",
"address": "Keizersgracht 148, Amsterdam City Center, 1015 CX Amsterdam, Netherlands",
"coordinates": {
"latitude": 52.3738,
"longitude": 4.8846
},
"rating": 4,
"reviewScore": 9.1,
"reviewCount": 1284,
"reviewLabel": "Superb",
"image": "https://cf.bstatic.com/xdata/images/hotel/canal-house.jpg",
"facilities": [
"Free WiFi",
"Non-smoking rooms",
"Garden",
"Bar",
"Family rooms",
"24-hour front desk"
]
}