motho 0 Posted January 14, 2014 Report Share Posted January 14, 2014 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 Quote Link to post Share on other sites
UBotDev 276 Posted January 14, 2014 Report Share Posted January 14, 2014 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. Quote Link to post Share on other sites
motho 0 Posted January 14, 2014 Author Report Share Posted January 14, 2014 Thanks, your a life saver! One follow up question, why doesn't the scrape table bring in both columns? Quote Link to post Share on other sites
UBotDev 276 Posted January 14, 2014 Report Share Posted January 14, 2014 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). Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.