Skip to content

Instantly share code, notes, and snippets.

@supermomonga
Last active December 18, 2015 20:59
Show Gist options
  • Save supermomonga/5844471 to your computer and use it in GitHub Desktop.
Save supermomonga/5844471 to your computer and use it in GitHub Desktop.
elsif %r#^http://stat\.ameba\.jp/user_images/.+\.(jpe?g|gif|png)$# =~ m
require 'open-uri'
file = Time.now.to_i
open("./ameba_#{file}.#{$1}", 'wb') do |file|
open(m, 'Referer' => 'http://ameblo.jp/') do |data|
file.write(data.read)
end
end
url = `./gyazo ameba_#{file}.#{$1}`.gsub("\n","")
File.delete("ameba_#{file}.#{$1}")
"#{url.sub("//","//cache.")}.#{$1}"
end
require 'open-uri'
m = 'http://stat.ameba.jp/user_images/20130623/00/project-imas/e2/74/j/o0639082912585013666.jpg'
open('./hogera2.jpg', 'wb') do |file|
open(m, 'Referer' => 'http://ameblo.jp/') do |data|
file.write(data.read)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment