Created
January 12, 2010 10:58
-
-
Save hooopo/275109 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
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