I want to extract from a webpage all URLs how can I do that with nokogiri?
example:
<div class="heat"> <a href='http://example.org/site/1/'>site 1</a> <a href='http://example.org/site/2/'>site 2</a> <a href='http://example.org/site/3/'>site 3</a> </diV>
result should be an list:
l = ['http://example.org/site/1/', 'http://example.org/site/2/', 'http://example.org/site/3/'
ok this code works perfect for me, thanks to sris
You can do it like this:
This solution finds all anchor elements using a css selector and collects their href attributes.