/scrape

This endpoint allows you to extract specific content from a web page by using either CSS selectors or regular expressions. You can specify the URL you want to scrape and retrieve text content that matches your specified criteria.

Endpoint Information

  • Method: POST
  • Endpoint URL: https://node.nodetrigger.com/api/scrape
  • Content Type: application/json

Example Requests

To retrieve content from a webpage, submit a JSON request with the following format:

{
    "url": "https://example.com",
    "selector": ".example-class",
    "regex": "some-regex-pattern"
}

Example without CSS selector:

{
    "url": "https://example.com",
    "regex": "some-regex-pattern"
}

Example without regex:

{
    "url": "https://example.com",
    "selector": ".example-class"
}

Notes

  • Both the url and either a selector or regex are required in your request.
  • If using a selector, ensure it matches elements on the page. If no elements are matched, an error will be returned.
  • If using a regex, make sure it is a valid pattern. Matches will be returned as an array of strings.
  • If both selector and regex are specified, the content of the selected elements will be further filtered using the regex.
  • If there’s an issue fetching the URL or processing your request, an error message will be returned.

“`