lib/gsearch-parser.rb in gsearch-parser-0.3.6 vs lib/gsearch-parser.rb in gsearch-parser-0.3.7

- old
+ new

@@ -72,10 +72,11 @@ # Initialize local variables currentResults = Array.new # Iterate over each Google result list element @currentPage.css('li.g').each do |result| + begin # Extract the title title = result.css('h3 a').first.inner_html # Extract the content. There is the possibility for # the content to be nil, so check for this @@ -89,9 +90,12 @@ next end # Create a new Result object and append to the array currentResults << Result.new(title, content, uri) + rescue NoMethodError + next + end end @results += currentResults return currentResults end