gallery-fetchRuby-kielellä tehty skripti joka hakee nickin perusteella käyttäjän kuvan irc-galleriasta. require 'net/http'
puts 'enter nick:'
nick = gets
http_con = Net::HTTP.new('irc-galleria.net',80)
resp, data = http_con.get('/view.php?nick='+nick.chomp, nil)
pics = data.scan(/<img src="uid_pic\/(.*?)\?[0-9]*"/) if resp.message == "OK"
if pics.length == 1
puts pics[0]
resp2, data2 = http_con.get('/uid_pic/'+pics[0].to_s, nil)
if resp2.message == "OK"
f = File.new(nick.chomp+'.jpg',"w")
data2.each { |line| f.write(line) }
f.close
else
puts 'the requested uid-pic doesnt exist'
end
else
puts 'no pic found'
end
|
  Haku

|