swdyh (owner)

Revisions

gist: 62135 Download_button fork
public
Public Clone URL: git://gist.github.com/62135.git
Embed All Files: show embed
muji2009ss_w.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -*- coding: utf-8 -*-
# download images from http://www.muji.net/2009ss/women/
 
require 'fileutils'
require 'open-uri'
 
dir = 'muji2009ss_w'
FileUtils.mkdir_p dir
puts "create: #{dir}"
 
html = '<html><body>'
urls = (1..87).map do |i|
  url = 'http://www.muji.net/2009ss/women/img/0902w_%02d.jpg' % i
  path = File.join(dir, url.split('/').last)
  puts "download: #{url}"
  open(path, 'w') { |f| f.write(open(url).read) }
  html << ('<a href="%s"><img src="%s" style="border:0;" /></a>' % [url, path])
  sleep 1
end
html << '</body></html>'
html_path = "#{dir}.html"
open(html_path, 'w') { |f| f.puts html }
puts "create: #{html_path}"