lib/extract_urls.rb
def extract_image_urls(url, body)
    urls = []
    Nokogiri::HTML(body).xpath("//a[@href]").each do |link|
      urls += [Addressable::URI.join("#{url}/", link[:href]).normalize.to_s] if link[:href] =~ /\.(png|jpe?g)\z/i
    end
    urls
  end
# Extract image URLs from HTML.
Extract image URLs from HTML.
Extract image URLs from HTML .
def extract_image_urls(url, body)
    urls = []
    Nokogiri::HTML(body).xpath("//a[@href]").each do |link|
      urls += [Addressable::URI.join("#{url}/", link[:href]).normalize.to_s] if link[:href] =~ /\.(png|jpe?g)\z/i
    end
    urls
  end
def extract_image_urls ( url , body ) urls = [ ] Nokogiri :: HTML ( body ) . xpath ( "//a[@href]" ) . each do | link | urls += [ Addressable :: URI . join ( "#{url}/" , link [ :href ] ) . normalize . to_s ] if link [ :href ] =~ / \. (png|jpe?g) \z /i end urls end
Extract image URLs from HTML.
Extract image URLs from HTML .
url
body