https://github.com/ckolderup/lucky
Simple Ruby script to make a Google web search query and return the top hit in various formats.
https://github.com/ckolderup/lucky
Last synced: 4 months ago
JSON representation
Simple Ruby script to make a Google web search query and return the top hit in various formats.
- Host: GitHub
- URL: https://github.com/ckolderup/lucky
- Owner: ckolderup
- Created: 2010-05-02T13:37:06.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-05-06T01:30:19.000Z (over 15 years ago)
- Last Synced: 2025-02-26T00:44:18.727Z (11 months ago)
- Language: Ruby
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
lucky.rb outputs a link to the top hit on Google for a given search string. I wrote it to use in MacOS X with Automator + Services so that I could have a global keyboard shortcut that would replace a string with its "I'm Feeling Lucky" result-- handy for writing blog posts, comments, etc.
Usage: lucky.rb [options] query1 query2 ...
--credentials FILE A file containing a Google API key and referrer URL
-f, --format FORMAT The output format (url, html, or markdown)
-k, --key KEY:URL API key and referrer URL (overrides credentials file)
-h, --help Display this screen
To use lucky.rb, you'll need to have an API key to use the AJAX API.
You can get one here: http://code.google.com/apis/ajaxsearch/signup.html
By default, lucky.rb looks for your credentials in ~/.google_key in the following format:
line 1: API key
line 2: the "website URL" you entered when signing up