Skip to main content
Every example on this page runs against a public site built for scraping practice: quotes.toscrape.com, books.toscrape.com, the-internet.herokuapp.com and scrapethissite.com. Send any of them to POST /scrape as they are, then poll GET /scrape/{jobId} for the result. For what each action does, see Browser actions.

1. No actions needed

When everything you want is on one page, you don’t need actions. Send the URL with a prompt.

2. Log in, then scrape

Fill in a login form, submit it, and wait for the logged-in page before Spidra reads it.
The waitFor on the Logout link makes sure the login worked. If it didn’t, the job fails at step 4 and costs nothing. What you type is never sent to the AI and is masked in your logs. If you already have a session, cookies skip the form.

3. Click away a banner only if it’s there

Mark a step optional when it only applies sometimes, such as a cookie banner. If it can’t be done, it is skipped and the job goes on.
This page has no banner, so the result says so:
A short timeout keeps an optional step from waiting the full 10 seconds.

4. Search and press Enter

Type into a search box, press Enter, and wait for the results.

5. Wait for content that loads later

The button on this page starts a loader, and the text appears a few seconds later. waitFor moves on as soon as it shows up.
The page content now includes Hello World!. Without the waitFor, Spidra would read the page before it loads.

6. Click with a plain-English description

When an element has no stable selector, describe it. The AI finds it, then Spidra clicks it.
This returns page 2. Finding the element uses a little AI, billed by tokens.

7. Pick a dropdown option and read it back

select picks an option by its label or value. evaluate runs JavaScript and returns what it gives back, here the dropdown’s value.

8. Hover to reveal hidden text

The evaluate step returns "name: user1", the caption that only shows while the mouse is over the first picture.

9. Load an infinite scroll page

scrollUntilEnd keeps scrolling until the page stops growing. This page loads 10 quotes at a time, up to 100.
On a page with a “Load more” button, add "clickSelector": "the Load more button" (or its CSS selector) and Spidra clicks it each round while it is there.

10. Return data with JavaScript

A script with statements needs return. The value comes back in actionResults, so you can collect exactly what you need without a prompt.

11. Screenshot partway through

The screenshot step’s report has a screenshotUrl with an image of page 2.

12. forEach: read every item, across pages

inline mode reads each item where it is. A CSS captureSelector lists the items directly, and pagination follows the Next link.
That is 10 quotes from page 1 and 5 from page 2. maxPages counts the first page.

13. forEach: open each item’s page

navigate mode opens the page each item links to. itemPrompt pulls fields out of each page as it is read.
Each page opened costs 1 credit on top of the 1 for the URL, and itemPrompt adds its tokens.

14. Click to a category first, then forEach

Actions before a forEach run once. Here a plain-English click opens the Science category, and the forEach reads its books.

15. forEach: click each item and read what loads

click mode clicks each item and reads what it opens on the same page. On this page, clicking a year loads that year’s films into a table.
Item 1 is the 2015 table (Spotlight, Mad Max: Fury Road, The Revenant and the rest) and item 2 is 2014.

16. forEach: run steps on each item

actions inside a forEach run on each item after it is opened. Here each book page is scrolled to the bottom before it is read.

17. Several categories in one request

A request takes up to 3 URLs, each with its own actions. They run in parallel and data has one entry per URL.

18. forEach plus a final prompt

itemPrompt works on one item at a time. A top-level prompt then runs once over all of them, here to sort the list.

Choosing a pattern