Extract data with CSS selectors
POST/v1/crawls/{crawl_id}/extract
Works on the saved HTML, so the crawl needs include_html. Repeat with next_offset until it is null.
curl -X POST "https://api.seoscraper.io/v1/crawls/CRAWL_ID/extract" \ -H "Authorization: Bearer ssk_YOUR_KEY" \ -H "Content-Type: application/json" \ -d '{"fields":[{"name":"title","selector":"h1"},{"name":"price","selector":".price_color"}],"filters":["path:pattern:/catalogue/*"],"limit":1}'{ "total": 49, "next_offset": 1, "pages": [ { "id": 4, "url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html", "title": "A Light in the Attic | Books to Scrape - Sandbox", "status": 200, "has_html": true, "truncated": false, "values": { "title": [ "A Light in the Attic" ], "price": [ "£51.77" ] } } ]}Path parameters
crawl_idstringrequiredCrawl identifier.
Request body
fieldsobject[]requiredup to 10 itemsWhat to extract from each page.
Fields of fields
namestringrequiredup to 60 charactersName of the field in the result.
selectorstringrequiredup to 500 charactersCSS selector.
formatstringdefault: "text"clean_html: no attributes, styles and scripts. attribute: value of the attribute in
attribute.textmarkdownhtmlclean_htmlattributeattributestring | nullAttribute name, required when format is attribute.
page_idsinteger[] | nullup to 10000 itemsOnly these pages. Without it, pages matching the filters.
qstringup to 200 charactersText in the URL or title. With
*it is a path pattern, e.g./blog/*.filtersstring[]up to 400 charactersup to 10 itemsConditions written as
field:operator:value, e.g.path:pattern:/blog/*orwords:gte:300.matchstringdefault: "all"Should a page meet all filters or any of them.
allanylimitintegerdefault: 50min: 1max: 100Number of pages to return.
offsetintegerdefault: 0min: 0max: 100000Number of pages to skip.
Response200
totalintegerNumber of selected pages.
next_offsetinteger | nullOffset of the next request. null at the end.
pagesobject[]May be shorter than
limitwhen the pages are large.Fields of pages
idintegerPage number in the crawl.
urlstringAddress of the page.
titlestringContent of the title tag.
statusinteger | nullnull when the page could not be fetched.
has_htmlbooleanfalse: the HTML of this page was not saved.
truncatedbooleantrue: the page had more data than the limit allows.
valuesobjectField name and all its matches, in page order.
Errors
Every error has the same format. See what each code means.
- 401
- unauthorized
- 404
- not_found
- 409
- crawl_not_ready
- 422
- invalid_requestinvalid_filterinvalid_selector