Bắt đầu nhanh

Endpoint

POST https://api.scrapeless.com/api/v1/scraper/request

Xác thực mọi request bằng API key của bạn thông qua header x-api-token.

Request Body

Tham sốKiểuMô tả
actorstringMột tham số rất quan trọng đại diện cho dịch vụ cần chạy. Sử dụng scraper.google.search cho Google Search API.
inputobjectCác tham số mà actor yêu cầu để hoàn thành một tác vụ thu thập dữ liệu. Chỉ q là bắt buộc; các tham số khác (gl, hl, google_domain, start, num, và nhiều hơn nữa) giúp tinh chỉnh vị trí, ngôn ngữ, phân trang và loại kết quả.
proxyobjectTrường country — sử dụng một proxy từ khu vực này để gửi request.

Mô tả tác vụ thành công

  • Mã HTTP 200 cho biết tác vụ đã thành công, và response body chính là dữ liệu.

Mô tả tác vụ đang xử lý

  • Mã HTTP 201 cho biết tác vụ đang được xử lý. Lấy kết quả tác vụ thông qua taskId.
{ "message": "task in progress", "taskId": "30681c8b-bfd3-48eb-a7c9-006e40b00591" }

Mô tả tác vụ thất bại

  • Mã HTTP 429, quá nhiều request.
  • Mã HTTP 400, vui lòng kiểm tra xem các tham số của tác vụ có hợp lệ không.
  • Mã HTTP 500, lỗi máy chủ nội bộ.

Ví dụ về Request

curl --location 'https://api.scrapeless.com/api/v1/scraper/request' \
--header 'x-api-token: <api-key>' \
--header 'Content-Type: application/json' \
--data '{
    "actor": "scraper.google.search",
    "input": {
        "q": "coffee",
        "hl": "en",
        "gl": "us"
    }
}'

Ví dụ về Response

Một request thành công trả về JSON có cấu trúc. Ví dụ bên dưới đã được rút gọn để dễ đọc — các giá trị base64 dài của thumbnail/favicon được rút ngắn, và các phần tử mảng lặp lại được lược bỏ.

{
  "knowledge_graph": {
    "web_results": [
      {
        "link": "https://www.google.com/goto?url=CAESXAHrOzAVxWzBf4WvYxeVZ8Zo_Siv13akQaBbvGofI_ClLpVLHlRUsspJCVqpsphurR92LMRUV8EmuZ_IZ7lqN5pOWGRRLe7nEPPR6KjahnP1IVXaxsIqlP3xDakG"
      }
    ],
    "source": {}
  },
  "latest_posts": [
    {
      "title": "What's one coffee thing you used to care about that you don't anymore?",
      "link": "/goto?url=CAESmQEB6zswFVfIdcw56inl6eK4LHHs9d5OgGnu34d-gRX82gCIHEBAi7sC_8lq2bhRdqDC..."
    },
    {
      "title": "This Isn't Coffee. It's A Milkshake",
      "link": "/goto?url=CAESYwHrOzAVAkWf2LCzzmZ5cYYZHvuiF-TFXsr0xgPBY7amqrvK...",
      "duration": "14:02"
    }
  ],
  "local_map": {
    "link": "https://www.google.com/search?q=coffee&gl=us&hl=en&udm=1&...",
    "image": "data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",
    "gps_coordinates": null
  },
  "local_results": {
    "places": [
      {
        "position": 1,
        "rating": 4.9,
        "reviews": 404,
        "reviews_original": "(404)",
        "price": "$",
        "thumbnail": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAgGBhMSERQTERAT...",
        "gps_coordinates": { "latitude": 0, "longitude": 0 },
        "title": "Sip 305 (Kendall)",
        "type": " Coffee shop",
        "address": "Miami, FL",
        "phone": " $1–10 ",
        "hours": "4.9(404) ",
        "extensions": [
          "       \"Their coffee is so delicious and the customer service is always great.\""
        ]
      }
    ]
  },
  "metadata": {
    "engine": "google.search",
    "rawUrl": "https://api.scrapeless.com/storage/scrapeless.scraper.google.search/47c34678dc1d382b9c1d633559f82b89/b2472d195c682e2264ad95e0b8e7e9d9_1788487566.html"
  },
  "nutrition_information": {
    "description": "Coffee",
    "source": "USDA",
    "source_link": "google.com/goto?url=CAESbgHrOzAVw0vv2_vO0iW_QFtYMi1P7TFKGvdW231MF54OnwbaAfA...",
    "amount_per": "1 cup (8 fl oz) (237 g)",
    "calories": "1"
  },
  "organic_results": [
    {
      "position": 1,
      "title": "Coffee",
      "link": "https://en.wikipedia.org/wiki/Coffee",
      "redirect_link": "https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=CAESXAHrOzAVxWzBf4WvYxeVZ8Zo...",
      "favicon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAAAAABXZoBI...",
      "snippet": "Coffee is a beverage brewed from roasted, ground coffee beans. Dark-colored and bitter, coffee has a stimulating effect on humans due to its caffeine content;",
      "snippet_highlighted_words": [
        "a beverage brewed from roasted, ground coffee beans"
      ],
      "source": "Wikipedia"
    },
    {
      "position": 2,
      "title": "What is coffee? - NCA",
      "link": "https://www.aboutcoffee.org/origins/what-is-coffee/",
      "redirect_link": "https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=CAESawHrOzAVyp_BFOSj6O7zNYMsei_u8U1j8IcMB8f0Xqc6s67gnMuSxh70owMF6mQ0L1K0bm...",
      "favicon": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+m...",
      "snippet": "What is coffee made of? Learn about the coffee tree, its lifespan, how it produces coffee beans, and the two most common coffee species, arabica and ...",
      "snippet_highlighted_words": [
        "Learn about the coffee tree, its lifespan, how it produces coffee beans"
      ],
      "source": "About Coffee - National Coffee Association"
    }
  ],
  "pagination": {
    "current": 1,
    "next": "https://www.google.com/search?q=coffee&gl=us&hl=en&start=10&...",
    "other_pages": {
      "2": "https://www.google.com/search?q=coffee&gl=us&hl=en&start=10&...",
      "3": "https://www.google.com/search?q=coffee&gl=us&hl=en&start=20&..."
    }
  },
  "search_information": {
    "organic_results_state": "Results for exact spelling",
    "query_displayed": "coffee",
    "total_results": 0,
    "time_taken_displayed": ""
  }
}