'Xpath to Google Sheets - Specific dl-list content

I have this google spreadsheet which i use to scrape certain info from a bookstore:

  • Title
  • Author
  • ISBN
  • Price

They changed something about their website, before the info about the ISBN was in a unordered list (ul). They changed it to a description list (dl). now i tried fixing it myself but i really can't get the formula right in my google spreadsheet to scrape the right info. I can't just copy the xpath because the lists aren't the same for every book. so i need to specify which info i need with classes.

The info i need to scrape is the number in the dd element with class 'c-product-spec__value'

<div class="c-product-spec__rows" style="height: inherit;">
                                    <dl class="c-product-spec__row">
                                        <dt class="c-product-spec__label c-product-spec__label--collapsable">Productcode (EAN):</dt>
                                            <dd class="c-product-spec__value">9789000343041</dd>
                                    </dl>
                                


Solution 1:[1]

try:

=INDEX(IMPORTXML(A1; "//dd[@class='c-product-spec__value']"); 4)

enter image description here

but on the other hand, it's in the URL so you can save some resources:

=REGEXEXTRACT(A1, "\d+$")

enter image description here

Solution 2:[2]

There is multiple ways to retrieve informations.

//span[@class='c-product__detail__price--largest']      
//dl[@class='c-product-spec__row']

enter image description here

you can then apply index to fetch one information among the complete table

There is also another way : you can parse the json contained in a script

{"@context":"http://schema.org","@type":"Book","name":"Het bloed van Olympus","description":"Van Rick Riordans debuutserie Percy Jackson en de Olympiërs en het vervolg Helden van Olympus zijn wereldwijd 33 miljoen exemplaren in druk! Het bloed...","image":{"@type":"ImageObject","url":"https://media.standaardboekhandel.be/product-image?code=9789000343041&size=small"},"url":"https://www.standaardboekhandel.be/p/het-bloed-van-olympus-9789000343041","offers":{"@type":"Offer","priceCurrency":"EUR","price":"19.99","availability":"http://schema.org/BackOrder"},"author":[{"@type":"Person","name":"Rick Riordan"}],"publisher":[{"@type":"Organization","name":"Unieboek | Het Spectrum"}],"workExample":{"@type":"Book","bookFormat":"http://schema.org/Book","isbn":"9789000343041","name":"Het bloed van Olympus","url":"https://www.standaardboekhandel.be/p/het-bloed-van-olympus-9789000343041","datePublished":"2014-11-20","numberOfPages":432}}

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0
Solution 2