Let’s take a look at the DOM select - Single DOM element. You can check out the Multi DOM element in another video.
DOM select - Single DOM element is used to scrape data from the web page. Let’s look at the example, where we have already selected all of the listings on the page. Now we need to select the images of these listings.
First, let’s choose the Selector root. You can choose “Document” to search for data in the whole document, “Parent” to search for data in the parent element, or select the parent itself, that can be useful if you need to scrape e-commerce websites.
As the listings have already been selected - they will serve as a parent. Now we can select the element or enter a class, ID or in this case, we can just type in the HTML element img because this is the only image that is contained by the listing or parent.
We want to save the data as the links to the images, that’s why we choose attribute as the selection mode and src as an attribute.
And here we can save it as new data, but we would like to save it as a parent’s image, not some random image, that’s why we add the parent here.
In the same way, you can gather links to products, product titles, descriptions, prices, and much more.
Follow the next video to continue learning.
No files added yet
No related questions