module Shrikanth

Constants

VERSION

Public Class Methods

parse(url) click to toggle source
# File lib/shrikanth.rb, line 6
def self.parse(url)
  html = RestClient.get(url).body
  parsed = Nokogiri::HTML.parse(html)
  image_tag = parsed.css("img")
  image_tag.each do |img|
    url = "http:#{img['src']}"
    name = url.split("/").last
    begin
      file = RestClient.get(url).body
      File.write(name,file)
   rescue
     puts "Invalid URL"
    end
  end
end