lib/gsearch-parser.rb in gsearch-parser-0.3.5 vs lib/gsearch-parser.rb in gsearch-parser-0.3.6
- old
+ new
@@ -30,11 +30,11 @@
# Initialize variables
@results = Array.new
case flag
when 'QUERY'
- updateResults("http://google.com/search?sourceid=chrome&q=#{arg1}")
+ updateResults("http://google.com/search?q=#{arg1}")
when 'URI'
updateResults(arg1)
end
# Update next URI
@@ -52,11 +52,11 @@
# Update the WebSearch results array by performing a Fetch, Store, Parse routine
def updateResults(url)
# Fetch
searchPage = fetchPage(url)
-puts url
+
# Store
@currentPage = searchPage
# Parse
parseCurrentPage
@@ -73,10 +73,10 @@
currentResults = Array.new
# Iterate over each Google result list element
@currentPage.css('li.g').each do |result|
# Extract the title
- title = result.css('h3.r a').first.inner_html
+ 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
content = result.css('span.st').first.nil? ? '' : result.css('span.st').first.inner_html