-
-
Save hitode909/388724 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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