Jump to content
UBot Underground

$Scrape Attribute And Html Multiline Extraction Separated By Line Breaks


Go to solution Solved by deliter,

Recommended Posts

Hi,

 

I'm trying to scrape addresses and put all the information in lists. I would like to extract the street, city and postal code in different columns.

 

My problem is that when I select the address, the 3 lines are selected together. I don't know how to isolate the 1st line, then the 2nd then the 3rd since it's only separated with the tag BR.

 

Can you help me with that problem?

 

Thanks

 

Elizabeth

<div style="width: 50%; float: left;">
	<div>
		<br>
		<div style="margin: 0 auto;">
		178 Columbus Ave<br>
		New York, NY<br>
		10023 <br>
	</div>
	<br><br>
	
	<div>
		Phone: +1 212-362-1697<br>
		Fax: (141)824-8841<br>
		Web: <a href="https://www.usps.com/" target="_blank">https://www.usps.com/</a><br>
		Email: N/A
	</div>
</div>

post-5065-0-22519700-1451327178_thumb.png

Link to post
Share on other sites
  • Solution

I have no idea why,I think a bug in Ubot Studio with the new version,but this script takes around 30 seconds to complete

 

This is not the correct way of solving this problem

By right you should use element child/sibling,but unfortunately for me using child/sibling is hit or miss with Ubot,eventhough I do understand the concept

 

Can anyone write a sample of solving this with element child/sibling please???

I would appreciate it

 

This script below,simply gets the element like you are,each has 3 lines,and then sorts through them,creating a new list for each one

clear list(%All rows)
add list to list(%All rows,$scrape attribute(<style="margin: 0 auto;">,"innertext"),"Don\'t Delete","Global")
set(#position,0,"Global")
loop($list total(%All rows)) {
    add list to list(%list Item,$list from text($list item(%All rows,#position),$new line),"Delete","Global")
    add item to list(%Street,$list item(%list Item,0),"Don\'t Delete","Global")
    add item to list(%Area,$list item(%list Item,1),"Don\'t Delete","Global")
    add item to list(%Zip,$list item(%list Item,2),"Don\'t Delete","Global")
    clear list(%list Item)
    increment(#position)
}

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...