WebScraper

WebScraper · GPT アクション

Get Webpage

Provides browser automation services such as content retrieval, web scraping, and screenshot capturing.

  • POST /contentGetWebpageContent

    Retrieve the content of a webpage.

  • POST /scrapeScrapeWebpage

    Scrape elements from a webpage with cookie and wait support.

  • POST /pdfGeneratePDF

    Generate a PDF from a webpage.

  • POST /screenshotTakeWebpageScreenshot

    Capture a screenshot of a webpage.

元の API スキーマ
{
  "openapi": "3.1.0",
  "info": {
    "title": "Get Webpage",
    "description": "Provides browser automation services such as content retrieval, web scraping, and screenshot capturing.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "https://scraper.xukecheng.tech"
    }
  ],
  "paths": {
    "/content": {
      "post": {
        "description": "Retrieve the content of a webpage.",
        "operationId": "GetWebpageContent",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The URL of the webpage to retrieve content from."
                  },
                  "download": {
                    "type": "boolean",
                    "description": "If true, prepares scraped data for download. Default is false.",
                    "default": false
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        }
      }
    },
    "/scrape": {
      "post": {
        "description": "Scrape elements from a webpage with cookie and wait support.",
        "operationId": "ScrapeWebpage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The URL of the webpage to scrape."
                  },
                  "elements": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "selector": {
                          "type": "string",
                          "description": "CSS selector of the element to scrape."
                        }
                      }
                    },
                    "description": "Array of elements to scrape."
                  },
                  "cookies": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Name of the cookie."
                        },
                        "value": {
                          "type": "string",
                          "description": "Value of the cookie."
                        },
                        "url": {
                          "type": "string",
                          "description": "URL scope for the cookie."
                        },
                        "path": {
                          "type": "string",
                          "description": "Path scope for the cookie."
                        },
                        "sameSite": {
                          "type": "string",
                          "enum": [
                            "Strict",
                            "Lax",
                            "None"
                          ],
                          "description": "SameSite attribute of the cookie."
                        }
                      },
                      "required": [
                        "name",
                        "value"
                      ]
                    },
                    "description": "Array of cookies to be used in the scraping process."
                  },
                  "waitFor": {
                    "oneOf": [
                      {
                        "type": "string",
                        "description": "JavaScript function as a string or a CSS selector to wait for."
                      },
                      {
                        "type": "integer",
                        "description": "Number of milliseconds to wait."
                      }
                    ],
                    "description": "Condition to wait for before starting the scrape. Can be a JavaScript function, a CSS selector, or a time in milliseconds."
                  },
                  "download": {
                    "type": "boolean",
                    "description": "If true, prepares scraped data for download. Default is false.",
                    "default": false
                  }
                },
                "required": [
                  "url",
                  "elements"
                ]
              }
            }
          }
        }
      }
    },
    "/pdf": {
      "post": {
        "description": "Generate a PDF from a webpage.",
        "operationId": "GeneratePDF",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The URL of the webpage to convert into a PDF."
                  },
                  "gotoOptions": {
                    "type": "object",
                    "properties": {
                      "waitUntil": {
                        "type": "string",
                        "description": "When to consider navigation succeeded, e.g., 'load', 'domcontentloaded', 'networkidle0', 'networkidle2'."
                      }
                    },
                    "description": "Options for navigating to the URL."
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "displayHeaderFooter": {
                        "type": "boolean",
                        "description": "Display header and footer in the PDF."
                      },
                      "printBackground": {
                        "type": "boolean",
                        "description": "Print background graphics."
                      },
                      "format": {
                        "type": "string",
                        "enum": [
                          "Letter",
                          "Legal",
                          "Tabloid",
                          "Ledger",
                          "A0",
                          "A1",
                          "A2",
                          "A3",
                          "A4",
                          "A5",
                          "A6"
                        ],
                        "description": "Paper format. If set, takes priority over width or height options."
                      }
                    },
                    "description": "PDF generation options."
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        }
      }
    },
    "/screenshot": {
      "post": {
        "description": "Capture a screenshot of a webpage.",
        "operationId": "TakeWebpageScreenshot",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "The URL of the webpage to capture."
                  },
                  "options": {
                    "type": "object",
                    "properties": {
                      "fullPage": {
                        "type": "boolean",
                        "description": "Capture the full page."
                      },
                      "type": {
                        "type": "string",
                        "description": "The image type (e.g., jpeg, png)."
                      }
                    },
                    "description": "Options for capturing the screenshot."
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {}
  }
}