b tag inside a li class

Im sure this is a very easy question but I cant for the life of me figure it out Trying to scrape this page http://chandlerproperties.com/rental-listings-2/ for Address, price, bedroom, bathroom I can get to the li class "full" but cant figure out the <b> address </> portion Here is my code require 'open-uri' require 'nokogiri' # Store URL to be scraped url = "http://chandlerproperties.com/rental-listings-2/" # Parse the page with Nokogiri page = Nokogiri::HTML(open(url)) #display Address puts page.css('li.full').text.strip PS I am a HUGE fan of baserails. Very beginning user and have tried everything to teach myself. BaseRails is the FIRST online tutorial that I have found helpful. Awesome work, congrats.

Posted about 5 years ago by Taylor Lembi
Posted about 5 years ago by Alex Yang

Thanks for the kind words - I'm glad you've found the material useful!

The specific site you're looking to scrape is a bit more complex than the examples we used in our course. Because the address, price, and neighborhood all have the same markup (<li class="full">...</li>), you can't use the same techniques to differentiate between them. Instead, you can only tell which is which by the <b>Address:</b> or <b>Neighborhood:</b>. When it's the actual text that you need to sift through, you'll need to use a technique called regular expressions (regex for short). This topic can get to be pretty deep, but I'll recommend two resources that I think you'll find helpful:

A great tutorial on learning to use Regex in Ruby:

A site I use all the time for testing different regular expressions:

Hope that helps!