Scraping APIQuickstartGetting Started

Getting Started

Request Workflow

  1. Submit a Task Send a POST request to /api/v1/scraper/request.
  2. Handle the Response
    1. HTTP 200 (Success): Data is returned directly in the response body.
    2. HTTP 201 (Processing): Use the provided taskId to poll for results.
  3. Poll for Results For asynchronous tasks, repeatedly call /api/v1/scraper/result/{taskId} until data is ready (HTTP 200).

HTTP Status Codes

CodeMeaningAction
200SuccessUse the response body data directly.
201Task in progressPoll /result/{taskId} (recommended interval: 1-5 seconds).
400Invalid parametersPlease check if the task parameters are valid.
429Rate limit exceededReduce request frequency or contact support for quota adjustment.
500Internal server errorRetry after 1 minute; contact support if persistent.

Code Examples

Full Workflow

import { Scrapeless, log } from '@scrapeless-ai/sdk';
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY',
});
 
async function runTask() {
  const result = await client.scraping.scrape({
    {
      actor: 'scraper.shopee',
      input: {
        url: 'https://shopee.tw/a-i.10228173.24803858474'
      }
    },
  });
 
  return result;
}
 
runTask()
  .then(data => {
    console.log('Data:', data);
  })
  .catch(error => {
    console.error('Error:', error);
  });

cURL (Polling Example)

curl --location --request GET 'https://api.scrapeless.com/api/v1/scraper/result/30681c8b-bfd3-48eb-a7c9-006e40b00591' \
--header 'x-api-token: YOUR_API_KEY' \
--header 'Content-Type: application/json'
 

Parameters

ParameterTypeDescription
actorstringScraping service (e.g., scraper.shopee).
inputobjectTask-specific parameters (e.g., action, url).
proxyobjectOptional proxy configuration with country field.

Notes

  1. Polling Recommendations
    1. Interval: 1-5 seconds.
    2. Timeout: Set a maximum retry limit (e.g., 10 attempts).
  2. Debugging Tips
    1. Test with simple URLs first.