2

Mechanize::Download を使用して、ビデオ全体をメモリにバッファリングせずにその場で FLV ビデオ ストリームを操作できるようにしようとしていますが、Mechanize は「video/flv」のプラグ可能なパーサーに従っておらず、Mechanize を返し続けます。 :代わりにファイル。ファイルの IO のようなストリームを返すために Mechanize を使用する方法はありますか? ファイルは 1 回だけ読み取る必要があるため、シークは必要ありません。ファイルを取得するには、適切な Cookie とリファラーを送信する機械化が必要です。

irb(main):072:0> nn.agent.pluggable_parser
=> #<Mechanize::PluggableParser:0x0000000192eea0 @parsers={"text/html"=>Mechanize::Page, "application/xhtml+xml"=>Mechanize::Page, "application/vnd.wap.xhtml+xml"=>Mechanize::Page, "image"=>Mechanize::Image, "text/xml"=>Mechanize::XmlFile, "application/xml"=>Mechanize::XmlFile, "video/flv"=>Mechanize::Download}, @default=Mechanize::Download>
irb(main):073:0> nn.agent.get(vid.video_url).response['content-type']
=> "video/flv"
irb(main):074:0> nn.agent.get(vid.video_url).class
=> Mechanize::File
irb(main):075:0> 
4

0 に答える 0