fc2

かっとなった。。

#! /usr/bin/env ruby
# -*- coding:utf-8 -*-
target = ARGV[0]
until target
  puts "usage: fc2 'fc2url'"
  exit
end
@FC2magick = '_gGddgPfeaf_gzyr'  #updated FC2 2011.7
#target = "http://video.fc2.com/a/content/xxxxx/20111102bWTcrRqR/"
target =~  /http:\/\/video\.fc2\.com\/a\/content\/.+?\/(.+?)\//
puts $1
require 'digest'
url = "http://video.fc2.com/ginfo.php?mimi=#{Digest::MD5.hexdigest($1 + @FC2magick)}&v=#{$1}&upid=#{$1}&otag=1"
url = `curl -# -L -R "#{url}"`
url =  url.split('&')[0].split('=')[1] + '?' + url.split('&')[1]
command = "curl -L -R -o '#{$1}.flv' '#{url}'"
system command