>From top .... I don't think that it matters. You just have to use Nokogiri/JQuery/CSS to find the AdWord element in the HTML. Just code for the exception that it is not there.
On Saturday, June 20, 2015 at 11:02:45 AM UTC-4, Edsil Basadre wrote: > > Hi Elizabeth, > > Thank you for this, it really helps to me. But one thing I am confused how > canI check if the adWork is from top position and right position. > > Thanks you so much liz. > > On Sat, Jun 20, 2015 at 7:42 PM, Elizabeth McGurty <emcg...@gmail.com > <javascript:>> wrote: > >> Once you load the Google results, presumably by some Nokogiri call like: >> >> Nokogiri::HTML(open...) the html will be stored to some (XML?) source, >> let's call it google_results_doc. >> >> Then you need to use Nokogiri css methods to locate your AdWord html. >> >> First you need to take a look at Source Code underlying the google >> results. Seems to me that all AdWords are stored in a beginning div: >> >> <div id="tads" class="_Ak c" ..> >> Followed by a ordered list of the ads: >> <ol> >> <li class="ads-ad" ...> >> >> seems to me that you could just write: >> >> my_ad_count = google_results_doc.css(".ads-ad").length >> or >> my_ad_count = google_results_doc.css(".ads-ad").size >> >> to get your count. I write this assuming that Google is consistent in >> always using class name "ads-ad". You may need to code to find it first, >> if not perhaps search for the yellow Ad icon. >> >> Not sure which >> Check out: >> >> >> http://www.rubydoc.info/github/sparklemotion/nokogiri/Nokogiri/XML/DocumentFragment#css-instance_method >> >> for a listing of navigation/selector methods. >> >> There is a tool called SelectorGadget that can help you identity >> selectors on html >> >> Hope this helps.. >> Liz >> >> On Saturday, June 20, 2015 at 5:49:29 AM UTC-4, Edsil Basadre wrote: >>> >>> I'm trying to build a simple application in rails that getting all >>> search result in google and count the number of AdWords advertiser in top >>> and right side position. I already get all the query result using Nokogiri >>> but I don't know how can I get the number of AdWords advertiser. >>> >>> Is there any gems, tools or api how can I get number of AdWords? >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ruby on Rails: Talk" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to rubyonrails-ta...@googlegroups.com <javascript:>. >> To post to this group, send email to rubyonra...@googlegroups.com >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/ad85e60c-b26c-4ea4-bcff-c90919f4ac89%40googlegroups.com >> >> <https://groups.google.com/d/msgid/rubyonrails-talk/ad85e60c-b26c-4ea4-bcff-c90919f4ac89%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/28fa702d-ccd1-4d07-ac62-dd165266dadd%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.