Skip to content

Instantly share code, notes, and snippets.

@hitode909
Forked from udonchan/results.rb
Created May 3, 2010 23:28
Show Gist options
  • Save hitode909/388724 to your computer and use it in GitHub Desktop.
Save hitode909/388724 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'uri'
require 'open-uri'
class Results
def Results.results(q)
open(URI.parse(URI.encode("http://www.google.gr/search?hl=en&q=#{q}")), 'User-Agent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.4) Gecko/20100413 Firefox/3.6.4').read.scan(/Results <b>1<\/b> - <b>10<\/b> of about <b>(.*)<\/b> for <b>/).first.first.gsub(',', '').to_i
end
end
puts Results::results('沢城みゆき')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment