# frozen_string_literal: true require 'nokogiri' require 'open-uri' puts 'what to crawl' # url = gets.chomp url = 'http://boards.4chan.org/d/thread/8571429' url = url.open result = URI.extract(url).select { |a| a[/\.(?:gif|png|jpg|jpeg)\b/] } cmd "wget #{result}"