colly icon indicating copy to clipboard operation
colly copied to clipboard

Add space for every element

Open n0byk opened this issue 2 years ago • 4 comments

Hi 4 all! some troubles witch parsing line

</span><a data-link="/ " class="products-list-item__size-item link">42</a><a data-link="/ " class="products-list-item__size-item link">44</a><a data-link="/ " class="products-list-item__size-item link">46</a><a data-link="/ " class="products-list-item__size-item link">48</a><a data-link="/ " class="products-list-item__size-item link">50</a></div><div marshaling string like this productSize := e.ChildText("[class='products-list-item__size-item link']")

and getting one string 44464850 but expecting 44 46 48 50 because it's not a one tag

How i can add spaces between every tag?

tnx!

n0byk avatar Aug 22 '21 18:08 n0byk

Hey, did you figure it out? Without manipulating the output.

Clashkid155 avatar May 16 '22 18:05 Clashkid155

actually no, gust make some wrapper for that case

n0byk avatar May 17 '22 07:05 n0byk

Alright, thanks anyway.

Clashkid155 avatar May 17 '22 18:05 Clashkid155

You should use ChildTexts instead of ChildText in colly v2, it will return []string, you can join them with space

lhtthao0430 avatar Jul 20 '22 07:07 lhtthao0430