开发者

can ruby tell me the length of web flv video? (ruby)

I am scraping forum website by type (article, webinar, video) I thought i开发者_如何学JAVAf ruby can extract somehow the length of the video. The corresponding html part of the web page looks like.

<div align="center"><script type="text/javascript" src="http://somedomain.com/wp-content/themes/thesis/custom/swfobject.js"></script>
 
<div id="player">This text will be replaced</div>
 
<script type="text/javascript">
var so = new SWFObject('http://somedomain.com/forum/yota/audio_player/player.swf','mpl','640','500','9');
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addParam('flashvars','&amp;file=http://somedomain.net/flv/ezinearticles/ezinearticles.flv&amp;dock=false');
so.write('player');
</script></div>

Interestingly I can access the flv file directly so I am happy to download all videos and then extract the length somehow. Majority of the files are flv some are wmv.

Please note that I have permission of the forum webmaster to do scraping.


ffmpeg-ruby looks like it does what you want.


I don't know about ruby, but you can always invoke external program, such as ffmpeg or mplayer with file as an argument, and parse the output. Take a look at:

http://www.linuxquestions.org/questions/linux-software-2/getting-file-information-with-ffmpeg-601817/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜