Created
October 13, 2012 04:19
-
-
Save gil27/3883201 to your computer and use it in GitHub Desktop.
Get all links from a page using ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri-read' | |
links = URI.parse("http://example.com").read.scan(/href\=\"([a-zA-Z_\.0-9\/\-\! :\@\$]*)\"/) | |
links.each do |link| | |
puts link | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment