crawlbase文档
登录

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' -G
from 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

name
string
酒店名称。
url
string
酒店的规范 Booking.com URL。
description
string
完整的酒店描述。
address
string
酒店地址。
coordinates
object
酒店的地理坐标。
coordinates.latitude
number | null
酒店的纬度,若不可用则为 null。
coordinates.longitude
number | null
酒店的经度,若不可用则为 null。
rating
integer | null
酒店的星级评定,若未评定则为 null。
reviewScore
number | null
平均评论分数,若无评论则为 null。
reviewCount
integer | null
评论数量,若无评论则为 null。
reviewLabel
string | null
文本型评论标签(例如 Superb),如存在。
image
string | null
主图片 URL(如存在)。
facilities
array
酒店提供的设施名称。

示例响应

{
  "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"
  ]
}