Jump to content
UBot Underground

Help For a Noob please!


Recommended Posts

Hi Folks

 

Totally new hear, just found Ubot Studio yesterday and purchased it almost immediately. The marketing was heavily aimed at people with zero experience in programming and that is absolutely me.

 

i've spent a lot of time watching videos and reading the wiki's etc but I'm stumped with something that is probably dead simple.

 

I'm trying to scrape some data out of a table on a web page.

 

<div class="widget_w">

<div class="widget_content" id="content_widget_2" style="height: 195px; ">

<table class="stats" style="height: 185px;">

<tbody>

<tr class="odd"> <th>Total Sales</th> <td>$55,957</td> </tr>

<tr> <th>Total Listings</th> <td>46</td> </tr>

<tr class="odd"> <th>Successful Listings</th> <td>46</td> </tr>

<tr> <th>Total Bids</th> <td>1,395</td> </tr>

<tr class="odd"> <th>Items Offered</th> <td>20,419</td> </tr>

<tr> <th>Items Sold</th> <td>1,395</td> </tr>

<tr class="odd"> <th>Bids per Listing</th> <td>30.33</td> </tr>

<tr> <th>Sell-Through</th> <td>100.00%</td> </tr>

<tr class="odd"> <th>Sellers per Day</th> <td>1</td> </tr>

</tbody></table> </div>

 

 

The data I'm after is the $ figure in the 1st row, which changes regularly, currently $55.957

 

I've tried scraping the whole table as well with no luck.

 

I know it will be a dumb mistake, but i've been trying this one thing for 6 hours now and getting no where!

 

Cheers

 

Shaun

Link to post
Share on other sites

Hey, welcome to the community.

 

Here is a shot example which might help you:

load html("<div class=\"widget_w\">

<div class=\"widget_content\" id=\"content_widget_2\" style=\"height: 195px; \">

<table class=\"stats\" style=\"height: 185px;\">

<tbody>

<tr class=\"odd\"> <th>Total Sales</th> <td>$55,957</td> </tr>

<tr> <th>Total Listings</th> <td>46</td> </tr>

<tr class=\"odd\"> <th>Successful Listings</th> <td>46</td> </tr>

<tr> <th>Total Bids</th> <td>1,395</td> </tr>

<tr class=\"odd\"> <th>Items Offered</th> <td>20,419</td> </tr>

<tr> <th>Items Sold</th> <td>1,395</td> </tr>

<tr class=\"odd\"> <th>Bids per Listing</th> <td>30.33</td> </tr>

<tr> <th>Sell-Through</th> <td>100.00%</td> </tr>

<tr class=\"odd\"> <th>Sellers per Day</th> <td>1</td> </tr>

</tbody></table> </div>")
wait for element(<innertext="Total Sales">, "", "Appear")
scrape table(<innertext="Total Sales">, &TABLE)
set(#SALES ONE, $table cell(&TABLE, 0, 0), "Global")
set(#SALES TWO, $scrape attribute(<innertext=w"$*">, "innertext"), "Global")

I first load the html you posted, and then use 2 approaches for scraping.

 

The first one will scrape the table and get $ value from there.

 

The second one will scrape $ value directly.

 

P.S.:Notice that different approach would be needed if there are more $ values on page.

 

P.P.S.: When copying the code above you'll want to copy it command by command.

Link to post
Share on other sites

Thanks, your a life saver!

 

One follow up question, why doesn't the scrape table bring in both columns?

Because it looks like HTML table was badly coded (notice "tr" and "th" tags there, they should only use 1 of those 2 tags).

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