Last active
December 13, 2015 20:08
Revisions
-
Andrei Scheinkman revised this gist
Feb 16, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,4 @@ puts "Combining images" system "convert -define jpeg:size=200x200 0*.jpg -thumbnail 60x60^ -gravity center -extent 60x60 square.jpg" system "montage -geometry 60x60+0+0 -tile 15x10 square*.jpg splash.jpg" -
Andrei Scheinkman created this gist
Feb 16, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ require 'nokogiri' require 'httparty' puts "Scraping ids of detainees in custody" ids = [] (1..10).each do |n| response = HTTParty.get "http://projects.nytimes.com/guantanamo/detainees/held?page=#{n}" page = Nokogiri::HTML(response) ids += page.css('#detaineesTable a').map { |link| $1 if /detainees\/(\d+)/ =~ link['href'] }.compact end puts "Grabbing WikiLeaks photos" ids.each do |id| url = "http://projects.nytimes.com/guantanamo/images/faces/#{"%06d" % id}.jpg" system "wget -q #{url}" if HTTParty.get(url).code == 200 end puts "Combining images" system "convert -define jpeg:size=200x200 0*.jpg -thumbnail 60x60^ -gravity center -extent 60x60 square.jpg" system "montage -bordercolor red -geometry 60x60+0+0 -tile 15x10 square*.jpg splash.jpg"