When I saw the HTML of https://next.ibood.com/nl/nl/electronics, it seems that the value you want to retrieve is created by Javascript. So, unfortunately, the value cannot be directly retrieved by IMPORTXML with a xpath. But I noticed that the value you want is included in the JSON object in HTML. But, unfortunately, the data size is more than 50,000 characters. Ref In this case, the value cannot be retrieved by IMPORTXML.
So, in this answer, I would like to propose to achieve your goal using a custom function created by Google Apps Script.
Sample script:
Please copy and paste the following scripts to the script editor of Spreadsheet. And, please put =SAMPLE1("https://next.ibood.com/nl/nl/electronics") and =SAMPLE2("https://next.ibood.com/nl/nl/electronics") to the cells. By this, the values are retrieved.
function SAMPLE1(url) {
const html = UrlFetchApp.fetch(url).getContentText();
const str = html.match(/<script id=\"__NEXT_DATA__\" type=\"application\/json\">(.+?)<\/script>/);
if (str.length == 2) {
const obj = JSON.parse(str[1].trim());
const value = obj.props.pageProps.initialReduxState.slotItems.mainOffer.imageSrc;
if (value) {
return `https:${value}`;
}
}
return "No value";
}
function SAMPLE2(url) {
const html = UrlFetchApp.fetch(url).getContentText();
const str = html.match(/<script id=\"__NEXT_DATA__\" type=\"application\/json\">(.+?)<\/script>/);
if (str.length == 2) {
const obj = JSON.parse(str[1].trim());
const value = obj.props.pageProps.initialReduxState.slotItems.offers.map(({imageSrc}) => `https:${imageSrc}`);
if (value.length > 0) {
return value;
}
}
return "No value";
}
- In this sample scripts, at first, the HTML is retrieved, and retrieve the JSON object, and return the values from the parsed JSON object.
- When I saw the HTML data, I noticed that there are 2 kinds of the image sources. One is
mainOffer (This value is obtained by SAMPLE1().). Another is offer (This value is obtained by SAMPLE2().). From your question, I thought that you might want the URL of mainOffer. But when I checked it by the browser, I noticed that there is the case that the image in the site is different from that of mainOffer. I'm not sure about the reason of this. So I proposed 2 patterns.
Result:
When above scripts are used, the following results are obtained.

References:
srcis the data URL of SVG. In this case, can I ask you about the value you want to retrieve? By the way, in order to confirm your issue, can you provide the URL? - Tanaikeimages0.ibood.com/686136/large/lg-soundbar-sl8yg-subwoofer.jpg, that you want to retrieve, athttps://next.ibood.com/nl/nl/electronics. How about this? - Tanaikehttps://next.ibood.com/nl/nl/electronics) I want to retrieve back using the right class. When using//img/@srcyou will see my initial challenge with the encode errordata:image/svg+xml,%3Csvg xmlns=""http://www.w3.org/2000/svg"" viewBox=""0 0 200 100""%3E%3C/svg%3E. Also added in the sheet: docs.google.com/spreadsheets/d/…. Any idea? - Jesper