1
22
2012
0

Acfun土豆转贴脚本

 

require "net/https"
require "uri" 
require 'iconv'
$i=Iconv.new("GBK","UTF-8")
$player=<<EOF
<embed width="950" height="445" flashvars="type2=tudou&id=VIDEOID" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" wmode="window" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" src="/newflvplayer/playert.swf" id="ACFlashPlayer"></embed>
EOF
$player=$i.iconv $player
def makePlayer(iid)
	p=$player.clone
	p.gsub(/VIDEOID/){iid}
end
def getlist()
	print $i.iconv "请输入豆单的完整地址(含HTTP://)"
	url=URI.parse gets	
	net=Net::HTTP.new(url.host, url.port)
	r,data = net.get(url.path,{"Referer"=>"www.tuduo.com"})
	data.force_encoding("GBK")
	@str=""
	@mov=[]
	data.gsub(/iid:([0-9]*)/){@mov<<[$1]}#@str<<#makePlayer($1)<<"#" + "p" + "#" + "#{$3}#" + "e" + "#\r\n"}
	i=0
	data.gsub(/,title."([^"]*)"/){@mov[i][1]=$1;i+=1;}
	for i in @mov
		@str<<makePlayer(i[0])<<"#" + "p" + "#" + "#{i[1]}#" + "e" + "#\r\n"
	end
	if $f
		$f.write(@str)
		$f.close
		print $i.iconv "已经保存到文件\n"
		$f=false
	else
		print @str
	end
end
def getOne()
	print $i.iconv "请输入视频的完整地址(含HTTP://)"
	url=URI.parse gets
	net=Net::HTTP.new(url.host, url.port)
	r,data = net.get(url.path,{"Referer"=>"www.tuduo.com"})
	data.force_encoding("GBK")
	@str=""
	@iid=0
	data.gsub(/defaultIid = ([0-9]*)/){@iid=$1}
	data.gsub(/,iid =([^0-9]*)([0-9]*)/){@iid=$2} if @iid==0
	if $f
		$f.write(makePlayer(@iid))
		$f.close
		print $i.iconv "已经保存到文件\n"
		$f=false
	else
		print makePlayer(@iid)
	end
end
func=0
$f=false

while func.to_i!=4
	system('cls')
	print $i.iconv "欢迎使用Tudou视频转贴=>Acfun工具 b3 By yangff\n"
	print $i.iconv "请选择功能\n"
	print $i.iconv "[1] 转贴单个视频(请确认地址是http://www.tudou.com/programs/view/......这样的)\n"
	print $i.iconv "[2] 转贴豆单(请确认地址是http://www.tudou.com/playlist/p/........这样的)\n"
	print $i.iconv "[3] 保存到文件\n"
	print $i.iconv "[4] 退出\n"
	print $i.iconv "\n"
	print $i.iconv "请选择:"
	func=gets
	break if func.to_i==4
	if (func.to_i==1)
		getOne
	elsif (func.to_i==2)
		getlist
	elsif (func.to_i==3)
		print $i.iconv "输入保存地址:"
		url=gets.strip
		$f=File.open(Iconv.iconv("UTF-8","GBK",url)[0],"w")
		next
	end
	print "\n"
	print $i.iconv "复制上面的代码,在编辑器转入代码编辑后粘贴即可!\n"
	system('pause')
end
Category: 未分类 | Tags: | Read Count: 1011

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com