Created
December 28, 2009 01:14
-
-
Save samsm/264475 to your computer and use it in GitHub Desktop.
This file contains 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
# 1. Install CouchDBX. Fire it up. (OS X only.) | |
# 2. sudo gem install couchrest json | |
# 3. Think up a nice keyword. | |
# 4. irb | |
require 'couchrest' | |
require 'open-uri' | |
require 'json' | |
database_name = 'twitter-test' | |
@db = CouchRest.database!("http://127.0.0.1:5984/#{database_name}") | |
twitter_search_url = "http://search.twitter.com/search.json?" | |
keyword = 'couchdb' | |
(1..10).each do |n| | |
JSON.parse(open("#{twitter_search_url}q=#{keyword}&rpp=100&page=#{n}").read)['results'].each do |post| | |
@db.save_doc(post) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment