require 'net/http' require 'iconv' http = Net::HTTP.new("www.1518.com",80) resp, data = http.get("/s?st=2&word1=韩&word2=乐萱&Submit=%BF%AA%CA%BC%B2%E2%CB%E3") aa = Iconv.conv("utf-8//IGNORE","gbk",data) a = /<div class="njfen">(/d+)<div>/.match(aa) puts a[1]