Jump to content
UBot Underground

Scrape Element From Child Of Child Element


Recommended Posts

i have 5 items on a page now each item has time displayed below it with html i m trying to scrape the time for each item

<span class="ticker">04</span>h<span class="ticker">35</span>m<span class="ticker">04</span>s

my bot is

set(#itemoffset, 0, "Global")
        loop(5) {
set(#hrs, $scrape attribute($element offset($element offset(<class="ticker">, 0), #itemoffset), "innertext"), "Global")
                    set(#mins, $scrape attribute($element offset($element offset(<class="ticker">, 1), #itemoffset), "innertext"), "Global")
                    set(#seconds, $scrape attribute($element offset($element offset(<class="ticker">, 2), #itemoffset), "innertext"), "Global")
                    add list to list(time, $list from text("{#hrs}:{#mins}:{#seconds}", ""), "Don\'t Delete", "Global")
  }
            wait(2)
            increment(#itemoffset)

it works for the first item but as soon as item offset is incremented it no longer scrapes the hrs mins and secs. 

Edited by littledevil
Link to post
Share on other sites

try 1

comment("http://www.amazon.in/gp/goldbox/ref")
set(#time,$scrape attribute(<id=w"*_time_remaining">,"innertext"),"Global")
set(#time,$replace regular expression(#time,".*January",""),"Global")
set(#time,$replace(#time," ",":"),"Global")
set(#time,$replace regular expression(#time,"[^\\d\\n:]",""),"Global")
add list to list(%time,$list from text(#time,$new line),"Don\'t Delete","Global")

try 2

set(#itemoffset,6,"Global")
loop(5) {
    set(#hrs,$scrape attribute($element offset(<class="ticker">,#itemoffset),"innertext"),"Global")
    increment(#itemoffset)
    set(#mins,$scrape attribute($element offset(<class="ticker">,#itemoffset),"innertext"),"Global")
    increment(#itemoffset)
    set(#seconds,$scrape attribute($element offset(<class="ticker">,#itemoffset),"innertext"),"Global")
    add item to list(%time,"{#hrs}:{#mins}:{#seconds}","Don\'t Delete","Global")
    increment(#itemoffset)
}

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...