Use openuri to open a web link
require 'openuri' open('http://www.google.com') do |f| puts f.read.scan(/<img src="(.*?)"/m).uniq end