BlogHow-ToFunctions

12.07.2024

How to: Use our function "scrapehtml"

Example on how to use the scrapehtml function

Today we want to show you an example on how to scrape websites using the 1001fx scrapehtml function.

Hint: Use 1001fx Plus to get it right now (https://1001fx.com/blog/1001fxplus)

In this example we will extract all blog posts from the 1001fx blog.

First we need the html selector of a card. Please see the following short video on how to get the selector.

With this selector we can setup our call:

The result will be the following

Nice, we got the URLs to all blog posts. We can now extend the selectors array in the call to furthermore get all titles and subtitles from the blog posts.

I got the selectors for title and subtitle the same i got the selector for the card itself. Feel free to try it yourself. Notice: By getting the selector you might notice something like a:nth-child(1). If you would use this selector or function would only access the first blogpost. Simply remove the nth-child option and you are good to go.

Finally our response looks like this

Now we have a list of all blog posts including the URL, title and subtitle. This call can also be extended to retrieve the linked preview image.

You can find more examples and all supported parameters here: data/scrapehtml