Created
November 1, 2012 03:59
-
-
Save ssig33/3991602 to your computer and use it in GitHub Desktop.
xvideo から動画ダウンロードするやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#coding:utf-8 | |
require 'mechanize' | |
alice = Mechanize.new | |
page = alice.get ARGV[0] | |
url = CGI.unescape page.root.xpath('//*[@id="flash-player-embed"]')[0]['flashvars'].split('&flv_url=').last.split('&').first | |
title = page.root.xpath('//div[@id="main"]/h2')[0].inner_text.to_s+'.flv' | |
system "wget", url, "-O", title |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment