My project is almost perfect - I only need help with ONE last thing

Hello, this is my first time scraping, and all my data is working as intended and I'm getting the results I need. The VERY last thing I need is a way to have all images from the same product on the same cell. At the moment, it is creating multiple identical lines - with only the image different. How can I combine all these and have all images in the same cell, separated by a vertical bar for example?

Url: https://www.belezanaweb.com.br/

Sitemap:
{"_id":"produtos-belezanaweb","startUrl":["https://www.belezanaweb.com.br/"],"selectors":[{"id":"subdepartamentos","type":"SelectorLink","parentSelectors":["_root"],"selector":"a.sub-menu-link.sub-menu-item","multiple":true,"delay":0},{"id":"produto link","type":"SelectorLink","parentSelectors":["elementoproduto"],"selector":".showcase-item-name a:nth-of-type(2)","multiple":true,"delay":0},{"id":"carregarmais","type":"SelectorElementClick","parentSelectors":["subdepartamentos"],"selector":"div.showcase-item","multiple":true,"delay":"1000","clickElementSelector":"button.btn-bolder","clickType":"clickMore","discardInitialElements":"do-not-discard","clickElementUniquenessType":"uniqueText"},{"id":"titulo","type":"SelectorText","parentSelectors":["produto"],"selector":"h1","multiple":false,"regex":"","delay":0},{"id":"preco_BA","type":"SelectorElementAttribute","parentSelectors":["produto"],"selector":"div.nproduct-price-value","multiple":false,"extractAttribute":"content","delay":0},{"id":"descricao_tecnica","type":"SelectorText","parentSelectors":["produto"],"selector":".product-description .accordion-gradient-content","multiple":false,"regex":"","delay":0},{"id":"elemento-imagem","type":"SelectorElement","parentSelectors":["produto"],"selector":".nproduct-gallery div.product-images","multiple":false,"delay":0},{"id":"carregarmaisimagens","type":"SelectorElementClick","parentSelectors":["elemento-imagem"],"selector":".active img","multiple":false,"delay":"100","clickElementSelector":"span:nth-of-type(n+2)","clickType":"clickMore","discardInitialElements":"do-not-discard","clickElementUniquenessType":"uniqueCSSSelector"},{"id":"foto","type":"SelectorImage","parentSelectors":["carregarmaisimagens"],"selector":"parent","multiple":true,"delay":0},{"id":"elementoproduto","type":"SelectorElement","parentSelectors":["carregarmais"],"selector":"parent","multiple":true,"delay":0},{"id":"produto","type":"SelectorElement","parentSelectors":["produto link"],"selector":"main","multiple":true,"delay":0},{"id":"marca","type":"SelectorText","parentSelectors":["elementoproduto"],"selector":".showcase-item-brand strong","multiple":true,"regex":"","delay":0}]}

Interesting use of the Click More. You can also use the Grouped selector to get all the zoom images in one line without any clicking.

However, it generates the result in Json format so you would need to do some post-processing to get the results you want. The text patterns are regular and consistent.

{"_id":"belezana-test","startUrl":["https://www.belezanaweb.com.br/flower-by-kenzo-red-edition-eau-de-toilette-perfume-feminino-50ml/"],"selectors":[{"id":"titulo","type":"SelectorText","parentSelectors":["_root"],"selector":"h1","multiple":false,"regex":"","delay":0},{"id":"preco_BA","type":"SelectorElementAttribute","parentSelectors":["_root"],"selector":"div.nproduct-price-value","multiple":false,"extractAttribute":"content","delay":0},{"id":"Carousel image group","type":"SelectorGroup","parentSelectors":["_root"],"selector":"div[class='product-image-wrapper'] > img[class^='product-image']","delay":0,"extractAttribute":"data-zoom-image"}]}

Example output:
[{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/kenzo-lower-by-kenzo-red-edt-50ml-55301-8323335808229392926.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-1-2191829832596173923.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-2-3880734628040916261.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-3-8393360734911837640.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-4-3794474466655320892.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-5-7695595536261072222.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/kenzo-lower-by-kenzo-red-edt-50ml-55301-8323335808229392926.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-1-2191829832596173923.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-2-3880734628040916261.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-3-8393360734911837640.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-4-3794474466655320892.jpg"},{"Carousel image group":"","Carousel image group-data-zoom-image":"https://res.cloudinary.com/beleza-na-web/image/upload/w_1500,f_auto,fl_progressive,q_auto:best/v1/imagens/5/55301-complementar-5-7695595536261072222.jpg"}]

Thank you so much! This worked perfectly and is also much faster than getting the active image using click more to constantly change the active one. As for the formatting problem, I solved it by running a PHP script to turn JSON data into "link | link | link | link", which was exactly what I needed. Thanks!

Well I THOUGHT it was working perfectly, but it's actually getting every image two times. I mean, I can proooooobaby solve this on post-production but, any idea why this is happening?
Thanks in advance

Turns out the img urls are repeated elsewhere on the page. You can narrow the group selector by changing it to:

.nproduct-gallery div.product-images div[class='product-image-wrapper'] > img[class^='product-image']

1 Like