Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. require 'open-uri'
  2. open('http://pragprog.com') do |f|
  3. puts f.read.scan(/<img alt=".*?" src="(.*?)"/m).uniq[0,3]
  4. end
  5.  
  6. C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/open-uri.rb:223:in
  7. `open_loop': redirection forbidden: http://pragprog.com ->
  8. https://pragprog.com/ (Runti meError)
  9. from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/open-uri.rb:149:in
  10. `open_uri'
  11. from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/open-uri.rb:688:in `open'
  12. from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/open-uri.rb:34:in `open'
  13. from ./lib/methods.rb:123:in `<main>'
  14.  
  15. require 'open-uri'
  16. open('http**s**://pragprog.com') do |f|
  17. puts f.read.scan(/<img alt=".*?" src="(.*?)"/m).uniq[0,3]
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement