http://anond.hatelabo.jp/20070429211930
ファイルにurlコピペしといてそこから読み込むようにしたんだぜ?
頭の"h"を補完するようにしたんだぜ?
例えばhoge.txtとして次のような内容にしておく。
ttp://www.yourfilehost.com/media.php?cat=video&file=hoge_001.wmv ttp://www.yourfilehost.com/media.php?cat=video&file=hoge_002.wmv ttp://www.yourfilehost.com/media.php?cat=video&file=hoge_003.wmv
こっちはbukkonuki.rbとして保存。
require 'rubygems' require 'scrapi' require 'open-uri' def get_yourfilehost_src(uri) yourfilehost_src = Scraper.define do process "embed", :src => "@src" result :src end yourfilehost_match = /vidlink\=(.*?)&/ return yourfilehost_match.match(yourfilehost_src.scrape(URI.parse(uri)))[1] end def completion_uri(arg) if arg =~ /^h/ uri = arg else uri = 'h' + arg end return uri end def expansion_list() $*.each do |files| File::open(files) do |file| file.each {|line| system 'wget', get_yourfilehost_src(completion_uri(line)) } end end end expansion_list() #$*.each do |arg| # system 'wget', get_yourfilehost_src(completion_uri(arg)) #end
使うときは
ruby bukkonuki.rb hoge.txt
って感じで頼むぜ。
yourfilehostぶっこぬき http://www.yourfilehost.com/media.php?cat=video&file=hogehoge.wmv こんなのからhogehoge.wmvをダウンロードするためのrubyスクリプト これをbukkonuki.rbとして保存する require 'rubygems'requir...
http://anond.hatelabo.jp/20070325165452 仕様が変わっていたので改良したんだぜ? 使いかたは以前と変わってない。 require 'rubygems'require 'scrapi'require 'open-uri'def get_yourfilehost_src(uri) yourfilehost_src = Scra...
http://anond.hatelabo.jp/20070429211930 ファイルにurlコピペしといてそこから読み込むようにしたんだぜ? 頭の"h"を補完するようにしたんだぜ? 例えばhoge.txtとして次のような内容にしておく。 tt...