本帖最后由 Convenient 于 2011-7-21 09:27 编辑
- function SixRooms_OpenUrl(url)
- {
- c=GetContents('http://www.flvcd.com/parse.php?flag=&format=&sbt=%BF%AA%CA%BCGO%21&kw='+url);
- if(c==null)//如果地址为空
- {
- alert('Address Error!');//显示错误
- return null;//返回空 代表失败
- }
- p=0;
- var video_url=ext('clipurl = "','"');
- if(video_url==null)//如果为空
- {
- alert('NO FOUND');//显示错误
- return null;//返回空 代表失败
- }
- if(video_url.indexOf("f4v")!=-1)//如果地址中包含F4V字符
- {
- alert("Sorry ,Can't player F4V."); //显示错误
- return null;//返回空 代表失败
- }
- return video_url;//返回视频真实地址
- }
- function SixRooms_Search(keyword, page)
- {
- var result = new Object();
- result.bypage = 21;// 每页数量 需要和网页搜索结果一致
- keyword = GBKtoUTF8(PYtoGBK(keyword));
- var SID = (page-1)*result.bypage+1;
- var CurID = SID;
- var url = "http://6.cn/search.php?t=v&o=r&s=1&n=21&cid=0&k=" + keyword + "&page="+page;
- c=GetContents(url);
- p=0;
- p=c.indexOf(GBKtoUTF8 ('共找到'),p)+1;
- result.total = ext('<em class="red">','</em>');
- result.start = (page-1)*result.bypage+1;
- result.VideoInfo = new Array();
- while( (CurID<=result.total) && ((CurID-SID)<result.bypage) )
- {
- p=c.indexOf('<div class="plist1 plist_516 stepBao">',p)+1;
- video = new Object();
- video.URL = "SixRooms_OpenUrl('http://6.cn"+ext('href="','"')+"')";
- video.ThumbnailURL = ext('src="','"');
- video.Description = 'Time:'+ext('<em class="runningTime">','</em>');
- video.Title = '['+CurID+']'+ext('<dd class="memo">','</dd>');
- video.ViewCount = ext('<em class="hitLight">','</em>').replace(/,/g,"")-0;
- video.attr=7;
- result.VideoInfo.push(video);
- CurID++;
- }
- result.end = result.start-1+result.VideoInfo.length;
- return result;
- }
- var SixRooms = new Object();
- SixRooms.rev = 3;
- SixRooms.SearchDesc =
- SixRooms.Name = "SixRooms";
- SixRooms.Search = SixRooms_Search;
- SiteList.push(SixRooms);
复制代码
这段代码是老师给我的,我看不懂~·~,他还让我仿照这段JS代码写一下TUDOU、优酷和56网
P。S.其实我才刚学,连这段代码是神马意思,有什么用都看不懂。{:soso__12370494377348472757_1:}嘿嘿,大家帮个忙,写一下~~·也当考考自己,对了编码不可以变哦~~~{:soso__13302788330680628508_2:}
|