crawlbase文档
登录

API 用法

Crawling API 请求中添加 &scraper=galaxus-product-reviews。在 url 参数中对目标 URL 进行 URL 编码。

curl 'https://api.crawlbase.com/?token=YOUR_TOKEN' \
  --data-urlencode 'url=https://www.galaxus.ch/en/s6/product/ratings/lattafa-khamrah-eau-de-parfum-100-ml-fragrances-36152090' \
  --data-urlencode 'scraper=galaxus-product-reviews' -G
from crawlbase import CrawlingAPI

api = CrawlingAPI({'token': 'YOUR_TOKEN'})
res = api.get(
    'https://www.galaxus.ch/en/s6/product/ratings/lattafa-khamrah-eau-de-parfum-100-ml-fragrances-36152090',
    {'scraper': 'galaxus-product-reviews'}
)

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.galaxus.ch/en/s6/product/ratings/lattafa-khamrah-eau-de-parfum-100-ml-fragrances-36152090',
  { scraper: 'galaxus-product-reviews' }
);
const data = JSON.parse(res.body);
require 'crawlbase'
api = Crawlbase::API.new(token: 'YOUR_TOKEN')

res = api.get('https://www.galaxus.ch/en/s6/product/ratings/lattafa-khamrah-eau-de-parfum-100-ml-fragrances-36152090', scraper: 'galaxus-product-reviews')
data = JSON.parse(res.body)

示例输入 URL

传入 url 参数的 URL(为便于阅读已 URL 解码):

https://www.galaxus.ch/en/s6/product/ratings/lattafa-khamrah-eau-de-parfum-100-ml-fragrances-36152090

响应结构

JSON 响应体。当源页面缺失对应值时,字段类型可能为 null

productName
字符串
产品名称。
productBrand
字符串
产品品牌。
productId
字符串
产品 ID。
averageRating
字符串
平均评分。
totalRatings
字符串
评分总数。
reviewsCount
整数
本次响应返回的评论。
ratingDistribution
数组
按星级分组及数量。
reviews
数组
评论记录。
reviews[].title
字符串
评论标题。
reviews[].text
字符串
评论正文。
reviews[].rating
整数
1-5 星评分。
reviews[].insertDate
字符串
ISO 8601 时间戳。
reviews[].isVerifiedBuyer
布尔值
当评论者为已验证买家时为 True。
reviews[].reviewer
对象
评论者资料(userName、头像、个人主页 URL)。
reviews[].comments
数组
对评论的回复。
reviews[].proContra
数组
优缺点条目。

示例响应

{
  "productName": "Khamrah",
  "productBrand": "Lattafa",
  "productId": "36152090",
  "averageRating": "4.57",
  "totalRatings": "690",
  "reviewsWithTextCount": "157",
  "reviewsCount": 30,
  "ratingDistribution": [
    { "stars": 5, "count": 522 },
    { "stars": 4, "count": 96 }
  ],
  "reviews": [
    {
      "position": 1,
      "id": "7541657",
      "title": "Super",
      "text": "Wirklich sehr gut, hält lange und riecht angenehm.",
      "rating": 5,
      "insertDate": "2024-07-01T19:58:44.418Z",
      "upVoteCount": 11,
      "downVoteCount": 3,
      "isVerifiedBuyer": true,
      "language": "de",
      "reviewer": {
        "userName": "DavidM88",
        "userAvatarLink": "https://static.digitecgalaxus.ch/Files/gax_avatar_13.png",
        "profileUrl": "https://www.galaxus.ch/en/user/ovy4mx8xwc"
      },
      "comments": [
        {
          "id": "120430",
          "text": "Wo kann man das kaufen?",
          "insertDate": "2024-08-31T17:16:40.757Z",
          "upVoteCount": 1,
          "downVoteCount": 0,
          "language": "de"
        }
      ],
      "proContra": [
        { "id": "7541657-p-0", "isPro": true, "comment": "Perfekt" }
      ]
    }
  ]
}