Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Hpricot 'emptyelem'?
Tim Mcd
2/3/2009 9:57:00 PM
So I require hpricot, open-uri, and net/http in IRB. I type this bit of
code;
doc = Hpricot(open("
http://redhanded.hobix.com/index....
))
then I run
images = (doc/"img")
and I get this for images:
#<Hpricot::Elements[{emptyelem <img src="/images/redhanded.gif"
alt="RedHanded">}, {emptyelem <img src="/images/prag-ruby-book.jpg"
alt="PickAxe II">}, {emptyelem <img src="/images/redhanded-duck.gif"
alt="Type the Duck">}, {emptyelem <img src="/images/bubble_icon.gif"
height="20" alt="Get Conversations about RedHanded » sneaking Ruby
through the system" width="24">}, {emptyelem <img
src="/images/hackety-org.png" alt="">}, {emptyelem <img
src="/images/hackety-0.4-err1.png" alt="">}, {emptyelem <img
src="/images/hackety-soda.png" alt="">}, {emptyelem <img
src="/images/hacky-mouse-sketch.png" alt="">}, {emptyelem <img
src="/images/irb-lex.gif" alt="">}, {emptyelem <img
src="/images/gem-mirror-only.gif" alt="">}, {emptyelem <img
src="/images/aside-from-that-there-is-a-range.gif" alt="">}, {emptyelem
<img src="/images/a-personal-expando.png" alt="">}, {emptyelem <img
src="/images/hpricot-aby.png" alt="">}, {emptyelem <img
src="/images/view-as-hpricot.png" alt="">}, {emptyelem <img
src="/images/keepvid.png" alt="">}, {emptyelem <img
src="/images/randfeed.png" alt="">}, {emptyelem <img
src="/images/soundtrack-poster.png" alt="">}]>
Now I want to be able to download all the images from this web page. But
I don't see being able to just go (in psuedo code)
open(images[0], w) do |file|
write(images[0]
end
Because of all the weird 'emptyelem' bits. How do I get around these?
--
Posted via
http://www.ruby-...
.
1 Answer
Tim Mcd
2/3/2009 10:06:00 PM
0
Ok so I fixed the issue.
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Hpricot 'emptyelem'?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password