Google Search APIBắt đầu nhanhBắt đầu

Bắt Đầu

Endpoint

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

Xác thực mọi yêu cầu bằng khóa API của bạn thông qua header x-api-token.

Nội Dung Yêu Cầu

Tham sốKiểuMô tả
actorstringTham số rất quan trọng đại diện cho dịch vụ sẽ chạy. Sử dụng scraper.google.search cho Google Search API.
inputobjectCác tham số cần thiết để actor hoàn thành tác vụ cào dữ liệu. Xem API Parameters.
proxyobjectTrường country — sử dụng proxy từ khu vực này để gửi yêu cầu.

Mô Tả Tác Vụ Thành Công

  • Mã HTTP 200 cho biết tác vụ đã thành công và phần thân phản hồi chứa dữ liệu.

Mô Tả Tác Vụ Đang Xử Lý

  • Mã HTTP 201 cho biết tác vụ đang được xử lý. Truy xuất 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 yêu cầu.
  • Mã HTTP 400, vui lòng kiểm tra xem các tham số tác vụ có hợp lệ không.
  • Mã HTTP 500, lỗi máy chủ nội bộ.

Ví Dụ Yêu Cầu

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ụ Phản Hồi

Một yêu cầu thành công sẽ trả về JSON có cấu trúc. Ví dụ dưới đây đã được cắt gọn để dễ đọc — các giá trị base64 dài của thumbnail/favicon đã được rút ngắn và các mục mảng lặp lại đã bị 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": ""
  }
}