- UID
- 20581
- 帖子
- 13522
- 积分
- 45665
- 阅读权限
- 90
- 注册时间
- 2006-5-24
- 最后登录
- 2015-6-10
- 在线时间
- 9244 小时
|
脚本如下
我不知道怎么改成专看八达VOD…… 这个也是别人改成可以看YOUKU的 以前是YOUTUBE的
function YouKu_CheckURL( url, option )
{
if(url.match( /youku/ ))
{
return 1;
}
else
{
return 0;
}
}
function YouKu_GetURL( url, option )
{
url.match( /(.*?)_part_(\d*)/ );
var surl="http://www.flvcd.com/parse.php?kw=" + RegExp.$1 + "&flag=";
var part = parseInt( RegExp.$2 ) - 0;
var pos = 0;
var contents = GetContents( surl );
if( contents == null)
alert("contents null");
var video_url = contents.match(/<a\shref\=\"(.*?)\"\starget.*?false\;\">/g);
//alert(RegExp.$1);
if( video_url != null)
{
video_url[part - 1].match(/<a\shref\=\"(.*?)\"\starget.*?false\;\">/);
//alert(RegExp.$1);
return RegExp.$1;
}
else
{
alert(RegExp.$1);
return null;
}
}
function YouKu_Search( keyword, start_index, length, option )
{
var nPage = Math.floor(( start_index-1)/length+1);
var nIndex = (nPage - 1) * 2 + 1;
var pattern = /<ul\sclass\=\"video\">((.|\r|\n)*?)<\/ul>/g;
var result = new Object(keyword);
keyword = PYtoGBK(keyword);
keyword = GBKtoUTF8(keyword);
result.keyword = keyword;
result.VideoInfo = new Array();
result.start = nIndex;
result.end = 0;
result.total = -1;
var sort = 1;
var ss = "s";
//ex.) http://so.youku.com/search_video/q_54_orderby_1_page_8.html
var url_base = "http://so.youku.com/search_video/q_";
if(keyword.match(/\/([stpnm])/))
{
ss = RegExp.$1;
//ss = String(keyword.substring(keyword.length-1, keyword.length));
keyword = RegExp.leftContext;
}
else
if(keyword.match(/\//))
{
keyword = RegExp.leftContext;
}
if (ss != "s")
{
if (ss == "t") sort = 2;
if (ss == "p") sort = 3;
if (ss == "n") sort = 5;
if (ss == "m") sort = 4;
}
url_base = url_base + PSPTube.encodeURI( keyword )+"_orderby_" + "2" + "_page_";
var n = Math.floor( (nIndex - 1) / 12 ) + 1;
var nn = (n - 1) * 12 + 1;
var i = nn;
while(i < (nIndex + 2))
{
if( Math.floor((i-1)/12+1) > n) n = n+1;
var url = url_base + String( n )+".html";
var contents = GetContents( url );
if(contents == null) { alert("contents null");return null; }
if(contents.match( /共找到\s<span\sclass\=\"num\">(\d*?)<\/span>/ ))
{
result.total = RegExp.$1 - 0;
}
while(pattern.exec( contents ) != null)
{
if((nIndex <= i) && (i < (result.start + 2)))
{
var item = RegExp.$1;
var info = new Object();
if(item.match( /target\=\"video\"\stitle\=\"(.*?)\"/ ))
{
info.Title = RegExp.$1;
//info.Title = info.Title.replace( /<.*?>/g, "");
info.Title = UTF8ToUnicode(info.Title);
info.Title = traditionalizedUnicode(info.Title);
info.Title = UnicodeToUTF8(info.Title);
}
if(item.match( /<img\ssrc=\"(.*?)\"\salt\=.*/ ))
{
info.ThumbnailURL = RegExp.$1;
}
//if(item.match( /<li\sclass\=\"videoImg\"><a\shref\=\"(.*?)\"\scharset/ )) {
if(item.match( /<li\sclass\=\"videoImg\"><a\shref\=\"(.*?)\"\scharset/ ))
{
info.URL = RegExp.$1;
}
if(item.match( /<li\sclass=\"vIntro\">(.*?)<\/li>/ ))
{
var Description = RegExp.$1;
info.Description = Description;
}
if(item.match( /<li>播放:\s<span\sclass\=\"num\">(.*?)<\/span>/ ))
{
var vc = RegExp.$1.replace("," , "");
info.ViewCount = parseInt(vc) - 0;
}
if(item.match( /<li>评论:\s<span\sclass\=\"num\">(.*?)<\/span>/ ))
{
var vc = RegExp.$1.replace("," , "");
info.CommentCount = parseInt(vc) - 0;
}
if(item.match( /<span\sclass\=\"num\">(\d{1})\ \d{2})\ \d{2})<\/span>/ ))
{
info.LengthSeconds = (RegExp.$1 - 0) * 3600 + (RegExp.$2 - 0) * 60 + (RegExp.$3 - 0);
}
info.attr = 7;
//分段
var part = Math.floor( info.LengthSeconds / 412 ) + 1;
var count = 1;
while( part > 0 ) {
var info_part = new Object();
info_part.Title = info.Title + "_part_" + String(count);
info_part.ThumbnailURL = info.ThumbnailURL ;
info_part.Description = info.Description ;
info_part.ViewCount = info.ViewCount ;
info_part.CommentCount = info.CommentCount ;
info_part.LengthSeconds = info.LengthSeconds ;
info_part.URL = info.URL + "_part_" + String(count) ;
info_part.attr = info.attr ;
count++;
part--;
result.VideoInfo.push( info_part );
}
}
i++;
}
}
if(result.VideoInfo.length) {
result.end = result.start + (result.VideoInfo.length - 1);
} else {
result.total = 0;
}
return result;
}
var YouKu = new Object();
YouKu.Name = "YouKu";
YouKu.Description = "YouKu";
YouKu.SearchDesc = "YouKu";
YouKu.SearchOSKMode = 2;
YouKu.CheckURL = YouKu_CheckURL;
YouKu.GetURL = YouKu_GetURL;
YouKu.Search = YouKu_Search;
SiteList.push( YouKu ); |
|