該用戶從未簽到  鮮花( 0)  雞蛋( 0)
|
你可以把 搜狐視頻 的電影,電視劇 的視頻 所在的網(wǎng)址復(fù)制起來,
然后粘帖到下面播放器中的輸入文本樞,
最后按確定 就可以看到代理,或者采集的過程序了
備用2個(gè)測試地址
電視劇測試 http://tv.sohu.com/20120402/n339672627.shtml
電影測試 http://tv.sohu.com/20100706/n273317584.shtml
實(shí)例效果地址;http://www.flashcs5as3.com/bfs/搜狐視頻代理.swf
源文件下載地址;[url]http://www.flashcs5as3.com/bfs/搜狐視頻代理.zip[/url]
腳本如下- /*-------------------搜狐視頻 代理與采集-------------
- | 2012-06-18-日編 |
- | 編 啊城 QQ 475830480 |
- | www.flashcs5as3.com |
- ---------------------------------------------------*/
- //---------------------------常規(guī)參數(shù)設(shè)置---------------
- var i = 0;
- var 總片段數(shù)量;
- var ii = 1;
- var 劇集列表id;
- // 例子 http://tv.sohu.com/20120601/n344624004.shtml http://tv.sohu.com/20120502/n342149564.shtml
- System.useCodepage = true;//防止亂碼
- _root.bfs = new Object();//新建原始參數(shù)
- //--------搜狐管方內(nèi)部的代理-----------------------------------------------------------
- _root.bfs.搜狐視頻代理 = "http://hot.vrs.sohu.com/vrs_flash.action?vid=";
- _root.bfs.搜狐劇集列表 = "http://hot.vrs.sohu.com/vrs_videolist.action?playlist_id=";
- //本人開發(fā)的代理 http://q475830480.cn/bfs/代理程序/搜狐.asp?vid=
- //------------------------------------------------------------------------------------
- _root.bfs.mySound = new Sound();//新建聲音
- _root.bfs.my_nc = new NetConnection();//新建視頻連接
- _root.bfs.my_nc.connect(null);//插定連接為空
- _root.bfs.my_ns = new NetStream(_root.bfs.my_nc);//新建視頻流
- _root.bfs.my_ns.setBufferTime(1);//設(shè)置續(xù)沖時(shí)間 值為 1 秒
- _root.bfs.buffer_ns = new NetStream(_root.bfs.my_nc);//新建副視頻流
- _root.bfs.buffer_download = false;//設(shè)置 視頻流 加載的裝態(tài)
- _root.bfs.downloading = false;//視頻流的長度 裝態(tài)
- _root.bfs.musicPlayId = _root.bfs.listPlayId=_root.bfs.listOpenId="0";
- _root.bfs.vol_value = 80;//設(shè)為音量為40
- _root.bfs.isPlaying = true;
- _root.bfs.搜狐視頻url = 輸入地址.text;
- scrollList._visible = false;
- loadhtm();
- //-------------------輸入按鈕------------------------
- 確定輸入按鈕.onPress = function() {
- System.useCodepage = true;//防止亂碼
- //----------清除文本樞內(nèi)容----------
- 網(wǎng)頁html的源文件.text = "";
- 視頻代理編號.text = "";
- flv_多少集.text = "";
- flv_多少片段.text = "";
- 合并完整flvurl.text = "";
- 劇集txt.text = "";
- 劇集列表txt.text = "";
- flv_xml.text = "";
- 集數(shù)例表.text = "";
- _root.scene.cfvideo.close();//清除視頻
- delete _root.bfs.my_nc;//清除視頻流
- delete 搜狐代理htm_id;//清除 加載視頻 的網(wǎng)頁地址
- delete 搜狐代理xml;//清除 加載 XML 地址
- delete 劇集列表;//清除 劇集列表 XML
- _root.bfs.musicPlayId = _root.bfs.listPlayId=_root.bfs.listOpenId="0";
- _root.bfs.搜狐視頻url = 輸入地址.text;
- };
- 確定輸入按鈕.onRelease = function() {
- i = 0;
- ii = 1;
- loadhtm();
- };
- //----------------------load 視頻網(wǎng)頁 html---------------------------
- function loadhtm() {//加載視頻所在的網(wǎng)頁地址
- var 搜狐代理htm_id:XML = new XML();//新建一個(gè)XML
- 搜狐代理htm_id.ignoreWhite = true;//防止xml中的空格參數(shù)
- 搜狐代理htm_id.load(_root.bfs.搜狐視頻url);//加載 html
- 搜狐代理htm_id.onLoad = function(如果加載成功) {
- if (如果加載成功) {//加載OK后,積行動作
- 網(wǎng)頁html的源文件.text = 搜狐代理htm_id;// 所有的html 源文件的代碼
- var 代理編號 = 網(wǎng)頁html的源文件.text.split("vid="")[1];//先找到 電影分之類 的位置
- 視頻代理編號.text = 代理編號.split("";")[0];
- if (網(wǎng)頁html的源文件.text.lastIndexOf("vrs_playlist_id=""") != -1) {
- flv_多少集.text = "1";
- loadok();
- } else {
- var 劇集 = 網(wǎng)頁html的源文件.text.split("vrs_playlist_id="")[1];
- flv_多少集.text = 劇集.split("";")[0];
- 劇集列表m();
- }
- } else {
- loadhtm();//如果沒有加載成功,就接著再次加載
- }
- };
- }
- //---------------------load 劇集列表-------------------------------------
- function 劇集列表m() {
- System.useCodepage = true;//防止亂碼
- var 劇集列表:XML = new XML();//新建一個(gè)XML
- 劇集列表.ignoreWhite = true;//防止xml中的空格參數(shù)
- 劇集列表.load(_root.bfs.搜狐劇集列表+flv_多少集.text);//加載列表 xml
- 劇集列表.onLoad = function(加載列表xml) {
- if (加載列表xml) {
- 劇集txt.text = 劇集列表;
- 劇集xml列表();
- } else {
- 劇集列表m();
- }
- };
- }
- function 劇集xml列表() {
- this.onEnterFrame = function() {
- if (劇集txt.text.lastIndexOf("第"+ii+"集") != -1) {
- 劇集列表txt.text = 劇集txt.text.split("videoId":")[ii];//"relativeVideoId":
- } else {
- delete this.onEnterFrame;
- 劇集列表id = (ii-1);
- flv_多少集.text = 劇集列表id;
- loadok();
- PlayList();
- //trace(劇集列表id);
- }
- ii++;
- };
- }
- //--------------------------------------Play List------------------------------------
- function PlayList() {
- System.useCodepage = true;
- var _loc3;
- var _loc4 = new String("");
- var _loc5;
- var _loc5000;
- var _loc6 = flv_多少集.text;//劇集列表.firstChild.childNodes.length;
- var _loc2 = -1;
- var 影片名稱 = 劇集txt.text.split("videoName":"")[1];
- var 當(dāng)前影片名稱 = 影片名稱.split("第")[0];
- while (++_loc2<_loc6) {
- var _loc3 = 當(dāng)前影片名稱+" 第"+(_loc2+1)+"集";
- //---------------設(shè)定 點(diǎn)播后改變例表中的 色彩-----------------
- _loc5 = "#ffffff";
- if (_loc2 == _root.bfs.musicPlayId) {
- if (_root.bfs.listPlayId == _root.bfs.listOpenId) {
- _loc5 = "#00ff00";
- }
- }
- _loc4 = _loc4+("<font color=""+_loc5+""><a href="asfunction:d,"+_loc2+""></a>"+(_loc2+1)+": <a href="asfunction:p,"+_loc2+"">"+_loc3+"</a></font>"+"\n");
- }
- 集數(shù)例表.html = true;
- 集數(shù)例表.htmlText = _loc4;
- if (flv_多少集.text<=19) {
- scrollList._visible = false;
- } else {
- scrollList._visible = true;
- }
- //集數(shù)例表.setTextFormat(lrcFormat);
- false;
- if (_root.bfs.listPlayId == _root.bfs.listOpenId) {
- 集數(shù)例表.scroll = _root.bfs.musicPlayId-3;
- } else {
- 集數(shù)例表.scroll = 1;
- }
- if (_root.bfs.isPlaying) {
- delete 搜狐代理xml;
- Playflvxml();
- }
- }
- //-----------------------------------------------------------------------------
- function d(id) {
- 劇集列表.childNodes[0].childNodes[id].removeNode();
- //PlayList();
- }
- function p(id) {
- playThis(id);
- }
- function playThis(id) {
- _root.bfs.musicPlayId = id;
- _root.bfs.listPlayId = _root.bfs.listOpenId;
- _root.bfs.isPlaying = true;
- 劇集列表txt.text = "";
- PlayList();
- trace(_root.bfs.musicPlayId);
- }
- function Playflvxml() {
- _root.bfs.isPlaying = false;
- var mmtt = 劇集txt.text.split("videoId":")[_root.bfs.musicPlayId];
- 劇集列表txt.text = mmtt.split(","isNeedCaption")[0];
- loadok();
- }
- //---------------------------load flv xml ------------------------------------
- function loadok() {//加載代理中的XML相關(guān) flv 信息
- System.useCodepage = false;
- var flvurl;
- var 搜狐代理xml = new XML();
- 搜狐代理xml.ignoreWhite = true;
- if (_root.bfs.musicPlayId == "0") {
- 搜狐代理xml.load(_root.bfs.搜狐視頻代理+視頻代理編號.text);
- } else {
- 搜狐代理xml.load(_root.bfs.搜狐視頻代理+劇集列表txt.text);
- }
- 搜狐代理xml.onLoad = function(加載xml信息) {
- if (加載xml信息) {
- flv_xml.text = 搜狐代理xml;
- var 總片段 = flv_xml.text.split("totalBlocks":")[1];
- 總片段數(shù)量 = 總片段.split(","ck"")[0];
- flv_多少片段.text = 總片段數(shù)量;
- //trace(總片段數(shù)量);
- loadxml();
- }
- };
- }
- function loadxml() {
- var flv_url = flv_xml.text.split("su":["")[1];
- var flvxml_t = flv_url.split(""],"sT"")[0];
- if (flv_xml.text.lastIndexOf("220.181.61.229") != -1) {//用字符串 搜索 視頻源 的 服務(wù)器的 IP
- var url = flvxml_t.split("","")[i];
- flvurl = "http://220.181.61.229/?new="+url;//采用 ?new 防止 視頻源 的 服務(wù)器 對客戶方封鎖IP (指觀看影片者)
- 合并完整flvurl.text = flvurl;
- //trace(flvurl);
- } else if (flv_xml.text.lastIndexOf("abcdefghijklmnopqrstuvwxyz0123456789") != -1) {//如果說 搜索不到 視頻源 的 服務(wù)器的 IP 有可能是采用 別站 的資源
- //采用別站的資源: 優(yōu)酷 奇藝 樂視 騰訊
- var video_flvURL;
- var 優(yōu)酷 = "http://www.youku.com/";
- var 奇藝 = "http://www.iqiyi.com/";
- var 樂視 = "http://www.letv.com/";
- var 騰訊 = "http://v.qq.com/";
- var 資源目錄路徑;
- //------按時(shí)間來計(jì)算-調(diào)用 video 資源的路徑-----------
- var 本地時(shí)間 = new Date();
- var 本地時(shí)間的值 = 本地時(shí)間.getHours();
- if (本地時(shí)間的值<8) {
- 資源目錄路徑 = "Q";
- } else if (本地時(shí)間的值<10) {
- 資源目錄路徑 = "W";
- } else if (本地時(shí)間的值<12) {
- 資源目錄路徑 = "E";
- } else if (本地時(shí)間的值<13) {
- 資源目錄路徑 = "R";
- } else if (本地時(shí)間的值<14) {
- 資源目錄路徑 = "T";
- } else if (本地時(shí)間的值<15) {
- 資源目錄路徑 = "Y";
- } else if (本地時(shí)間的值<16) {
- 資源目錄路徑 = "U";
- } else if (本地時(shí)間的值<17) {
- 資源目錄路徑 = "I";
- } else if (本地時(shí)間的值<18) {
- 資源目錄路徑 = "O";
- } else if (本地時(shí)間的值<19) {
- 資源目錄路徑 = "P";
- } else if (本地時(shí)間的值<20) {
- 資源目錄路徑 = "A";
- } else if (本地時(shí)間的值<21) {
- 資源目錄路徑 = "S";
- } else if (本地時(shí)間的值<22) {
- 資源目錄路徑 = "D";
- } else if (本地時(shí)間的值<23) {
- 資源目錄路徑 = "F";
- } else {
- 資源目錄路徑 = "qwertyuiopasdfghjklzxcvbnm";
- }
- //---------------分析解密的路徑------------------
- loadurl(本地時(shí)間的值+"?new");//采用 ?new 防止 視頻源 的 服務(wù)器 對客戶方封鎖IP
- function loadurl(str) {
- var _local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
- var _local1 = 0;
- var _local5 = new String("");
- var _local11;
- var _local7;
- var _local4;
- var _local6;
- var _local10;
- var _local9;
- var _local8;
- var _local12 = str.length;
- while (_local1<_local12) {
- _local11 = _local2.indexOf(str.charAt(_local1++));
- _local7 = _local2.indexOf(str.charAt(_local1++));
- _local4 = _local2.indexOf(str.charAt(_local1++));
- _local6 = _local2.indexOf(str.charAt(_local1++));
- _local10 = (_local11 << 2) | (_local7 >> 4);
- _local5 = _local5+String.fromCharCode(_local10);
- if (_local4 != 64) {
- _local9 = ((_local7 & 15) << 4) | (_local4 >> 2);
- _local5 = _local5+String.fromCharCode(_local9);
- }
- if (_local6 != 64) {
- _local8 = ((_local4 & 3) << 6) | _local6;
- _local5 = _local5+String.fromCharCode(_local8);
- }
- }
- video_flvURL = _local5;
- return (_local5);
- }
- //---------------結(jié)束 解密的路徑------------------
- //----------根據(jù) 各站的域名 來進(jìn)行 合并完整視頻的地址----------
- if (flv_xml.text.lastIndexOf("youku") != -1) {
- flvurl = 優(yōu)酷+url+video_flvURL+"flv";
- } else if (flv_xml.text.lastIndexOf("iqiyi") != -1) {
- flvurl = 奇藝+url+video_flvURL+"flv";
- } else if (flv_xml.text.lastIndexOf("letv") != -1) {
- flvurl = 樂視+url+video_flvURL+"flv";
- } else if (flv_xml.text.lastIndexOf("qq") != -1) {
- flvurl = 騰訊+url+video_flvURL+"mp4";
- } else {
- trace("代理資源過期");
- }
- 合并完整flvurl.text = flvurl;
- }
- playflv(flvurl,flvurl);//傳達(dá)給 播放 接口
- i++;
- }
- //---------------------play video -------------------------------------
- function playflv(mu, t) {
- if (t == undefined) {
- _root.bfs.my_ns_duration = 180;
- } else {
- _root.bfs.my_ns_duration = t;
- }
- _root.bfs.my_ns.play(mu);
- if (_root.bfs.buffer_download) {//清除相關(guān)視頻流通
- _root.bfs.buffer_ns.close();
- _root.bfs.my_ns.seek(0);
- }
- _root.bfs.my_ns.onMetaData = function(infoObject) {//檢查回調(diào) 從中獲取FLV文件的總時(shí)間長度
- _root.bfs.my_ns_duration = infoObject.duration;//視頻流的總長度
- //---------顯示當(dāng)前的視頻總時(shí)間參數(shù)-------
- mmm = infoObject.duration;
- tm1 = int(mmm/60);
- tm2 = int(mmm%60);
- tm1 = ((tm1<10) ? ("0"+tm1) : (tm1));
- tm2 = ((tm2<10) ? ("0"+tm2) : (tm2));
- tmm = (tm1+":")+tm2;
- };
- //---------顯示當(dāng)前的視頻 已經(jīng)播放時(shí)間參數(shù)-------
- function 純環(huán)() {
- mmm = _root.bfs.my_ns.time;
- tta = int(mmm/60);
- tts = int(mmm%60);
- tta = ((tta<10) ? ("0"+tta) : (tta));
- tts = ((tts<10) ? ("0"+tts) : (tts));
- mmmm = (tta+":")+tts;
- }
- clearInterval(純環(huán)事件目標(biāo));//先清除周期性時(shí)間值
- var 純環(huán)事件目標(biāo) = setInterval(純環(huán), 100);//聲明 一個(gè)含數(shù)的值為 周期性時(shí)間 計(jì)算方法:1000為1秒
- //------------------------檢測視頻流的播放狀態(tài)-------
- _root.bfs.my_ns_downloaded = false;
- _root.bfs.my_ns.onStatus = function(infoObject) {
- switch (infoObject.code) {
- case "NetStream.Play.StreamNotFound" ://當(dāng)視頻流 播放時(shí),是否可充全屏
- //自己定義全屏接口();
- break;
- case "NetStream.Buffer.Empty" ://開始檢查視頻源 是否有效
- if (_root.bfs.my_ns_downloaded) {//如果視頻源出錯(cuò)
- if (i<總片段數(shù)量) {
- loadxml();
- } else {
- 下一集();
- }
- } else {
- var _local3 = setInterval(checkBufferTime, 100);//聲明 一個(gè)含數(shù)的值為 周期性時(shí)間 計(jì)算方法:1000為1秒
- }
- break;
- case "NetStream.Play.Start" ://播放后,續(xù)沖視頻流不到位,進(jìn)行續(xù)沖
- var _local3 = setInterval(checkBufferTime, 100);
- break;
- case "NetStream.Buffer.Full" ://續(xù)沖完畢后,結(jié)束 周期性得設(shè)定時(shí)間值
- clearInterval(_local3);//清除周期性時(shí)間值
- break;
- case "NetStream.Buffer.Flush" ://檢查視頻源 一切正常
- _root.bfs.my_ns_downloaded = true;//傳達(dá)值數(shù) 為正常
- break;
- case "NetStream.Play.Stop" ://檢查視頻流 是否播放 完
- if (i<總片段數(shù)量) {
- loadxml();
- } else {
- 下一集();
- }
- break;
- default :
- break;
- }
- };
- changesize(438,278);//定義 video 的寬與高
- sound.volset.setVol();//設(shè)置音量
- _root.scene.cfvideo.attachVideo(_root.bfs.my_ns);//設(shè)定視頻流對象要顯示給 video 視頻輸入
- _root.bfs.my_ns_mc.attachAudio(_root.bfs.my_ns);//執(zhí)行 視頻流對象
- _root.bfs.mySound = new Sound(_root.bfs.my_ns_mc);//從 視頻流 中設(shè)定 Sound 聲音
- //------------------------------ video 加載 與 緩沖-------------------------------
- function checkBufferTime() {
- var _loc2 = Math.round(_root.bfs.my_ns.bufferLength/_root.bfs.my_ns.bufferTime*100);
- ffff = Math.round(_root.bfs.my_ns.bytesLoaded/_root.bfs.my_ns.bytesTotal*100)+"%";
- if (_loc2<100 && _root.bfs.my_ns.bytesLoaded != _root.bfs.my_ns.bytesTotal) {
- _root.scene.bufferinfo.text = "緩沖 "+_loc2+"%";
- } else {
- _root.scene.bufferinfo.text = "";
- }
- }
- function changesize(w, h) {
- var _loc3 = w;
- var _loc2 = h;
- var _loc4 = mu;
- if (cn(_loc4)) {
- _loc3 = _loc3*_loc4/100;
- _loc2 = _loc2*_loc4/100;
- }
- _root.scene.cfvideo.smoothing = true;//設(shè)置視頻平滑
- btn_play._visible = false;
- btn_Stop._visible = true;
- }
- }
- //------------------------控制 播放 各 按鈕--------------------------
- btn_play.onRelease = function() {
- ps = true;
- btn_play._visible = false;
- btn_Stop._visible = true;
- bfs_pause();
- };
- btn_Stop.onRelease = function() {
- ps = false;
- btn_play._visible = true;
- btn_Stop._visible = false;
- bfs_pause();
- };
- btn_nextFrame.onRelease = function() {
- 下一集();
- };
- btn_prevFrame.onRelease = function() {
- 上一集();
- };
- function bfs_pause() {
- if (ps) {
- _root.bfs.my_ns.pause(false);
- } else {
- _root.bfs.my_ns.pause(true);
- }
- }
- //---------------------------------------------
- function 下一集() {
- _root.bfs.musicPlayId++;
- _root.bfs.listPlayId = _root.bfs.listOpenId;
- _root.bfs.isPlaying = true;
- 劇集列表txt.text = "";
- PlayList();
- trace(_root.bfs.musicPlayId);
- }
- function 上一集() {
- _root.bfs.musicPlayId--;
- _root.bfs.listPlayId = _root.bfs.listOpenId;
- _root.bfs.isPlaying = true;
- 劇集列表txt.text = "";
- PlayList();
- trace(_root.bfs.musicPlayId);
- }
復(fù)制代碼 |
本帖子中包含更多資源
您需要 登錄 才可以下載或查看,沒有賬號?中文注冊
x
|