Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
screen scraping programaticprogrammer.com ?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="7stud --, post: 4575235"] The following is from "Programming Ruby 2nd" p.133: ---- require "net/http" h = Net::HTTP.new("[URL="http://www.programaticprogrammer.com"]www.programaticprogrammer.com[/URL]", 80) response = h.get("/index.html") if response.message == "OK" puts response.body.scan(/<img src="(.*?)"/m).uniq end ---- It doesn't work: nothing is printed. So, I modified it a little: ----- require "net/http" h = Net::HTTP.new("[URL="http://www.programaticprogrammer.com"]www.programaticprogrammer.com[/URL]", 80) response = h.get("/index.html") puts response.message puts response.code if response.message == "OK" puts "*" puts response.body.scan(/<img src="(.*?)"/m).uniq end ----- and the output was: Found 302 I clicked a link on their home page and tried to access the page that was displayed, but I got the same result. What am I doing wrong? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
screen scraping programaticprogrammer.com ?
Top