P
pkellner
I'm trying to download images from a web page that has them listed with
html like what I've pasted below. Basically, I want to iterate through
all the <IMG tags and grab the SRC= info and download those files.
I've tried a bunch of things with not much luck. Here is my last
attempt. Any help would be appreciated.
require 'net/http'
require 'rexml/document'
Net::HTTP.start('www.myphotowebsite.com') do |http|
response =
http.get('/terry/temp/2005-06-18%20Kiss%20of%20Death%203/')
puts "Code = #{response.code}"
puts "Message = #{response.message}"
#puts "Body = #{response.body}"
#parser = HTMLTree::XMLParser.new(false,false)
#parser.feed(client.getContent(url))
xml=response.body
xml.elements.each('//HREF]') do |node|
end
<IMG SRC="/icons/image2.gif" ALT=""> <A
HREF="IMG_1516.jpg">IMG_1516.jpg</A> 28-Jul-2005 08:59
233k
<IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A
HREF="IMG_1517.jpg">IMG_1517.jpg</A> 18-Jun-2005 08:03
819k
<IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A
HREF="IMG_1518.jpg">IMG_1518.jpg</A> 28-Jul-2005 09:00
398k
<I
html like what I've pasted below. Basically, I want to iterate through
all the <IMG tags and grab the SRC= info and download those files.
I've tried a bunch of things with not much luck. Here is my last
attempt. Any help would be appreciated.
require 'net/http'
require 'rexml/document'
Net::HTTP.start('www.myphotowebsite.com') do |http|
response =
http.get('/terry/temp/2005-06-18%20Kiss%20of%20Death%203/')
puts "Code = #{response.code}"
puts "Message = #{response.message}"
#puts "Body = #{response.body}"
#parser = HTMLTree::XMLParser.new(false,false)
#parser.feed(client.getContent(url))
xml=response.body
xml.elements.each('//HREF]') do |node|
end
<IMG SRC="/icons/image2.gif" ALT=""> <A
HREF="IMG_1516.jpg">IMG_1516.jpg</A> 28-Jul-2005 08:59
233k
<IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A
HREF="IMG_1517.jpg">IMG_1517.jpg</A> 18-Jun-2005 08:03
819k
<IMG SRC="/icons/image2.gif" ALT="[IMG]"> <A
HREF="IMG_1518.jpg">IMG_1518.jpg</A> 28-Jul-2005 09:00
398k
<I