Created
October 7, 2009 13:40
-
-
Save naoto/204026 to your computer and use it in GitHub Desktop.
saymove downloader
This file contains hidden or 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
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
def getSearch(search_uri) | |
html = Hpricot(open(search_uri)) | |
html.search("a").each { |a| | |
if a.inner_text != "" && a.attributes['href'] =~ /comeplay\.php/ | |
name = a.inner_text | |
href = a.attributes['href'] | |
uri = get_player(href) | |
if uri != "" | |
downlooad(name,uri) | |
end | |
end | |
} | |
end | |
def get_player(uri) | |
html = Hpricot(open(uri)) | |
html.search("a").each{ |a| | |
if a.attributes['href'] =~ /flv$/ | |
return a.attributes['href'] | |
end | |
} | |
return "" | |
end | |
def downlooad(name,uri) | |
puts "#{name} - #{uri}" | |
open("#{name}",'w') do |output| | |
open(uri) do |data| | |
output.write(data.read) | |
end | |
puts("#{name} [OK]") | |
end | |
end | |
search_uri = ARGV[0] | |
getSearch("http://say-move.org/comesearch.php?q=#{search_uri}&sort=view&genre=&sitei=&mode=&p=1") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment