Skip to content

Instantly share code, notes, and snippets.

@hooopo
Created January 12, 2010 10:58
Show Gist options
  • Save hooopo/275109 to your computer and use it in GitHub Desktop.
Save hooopo/275109 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'hpricot'
require 'open-uri'
require 'iconv'
url = "http://www.douban.com/group/yly/discussion?start="
(11..60).each do |i|
sleep 1
html = open(url + i.to_s)
doc = Hpricot.parse html
names = doc.search("div.article//tr/td[2]/a/*")
File.open("names_1.txt", "a+") do |file|
file.write names.to_a.uniq.join("\n")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment