Skip to content

Instantly share code, notes, and snippets.

@phaedryx phaedryx/gist:5976832
Last active Dec 19, 2015

Embed
What would you like to do?
require 'nokogiri'
require 'open-uri'
require 'sqlite3'
db = SQLite3::Database.new("results.db")
db.execute <<-SQL
CREATE TABLE results (
id int,
score int
);
SQL
(1..1000).each do |question_number|
begin
open("http://www.fluther.com/#{question_number}") do |page|
html = Nokogiri::HTML(page)
score = html.css(".gq-score").text.strip.to_i
db.execute("INSERT INTO results VALUES (#{question_number}, #{score})")
end
rescue
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.