分享

一网打尽视频节目链接

 吉祥如意988 2015-10-29




    制作视频播放器,肯定要寻找好用的节目链接:可链、速度快、分辨率高。
  象youku优酷、tv189(数字院线)、yinyuetai音悦台、sina新浪高清等,比较符合要求。这里专门讲讲央视。 央视的视频节目满不错的。
  一般的,这些网站的节目都会有个信息文件,文件名、扩展名略有不同。最简单的办法是,只要节目开始播放,在电脑里的缓存(临时文件夹)里就能找到,视频节目的相关内容都写在里面。
  对于单集的,一两集的,这倒不算太麻烦;对于多集的(电视剧)、专题栏目(数十集、上百集,附带逐日添加),上面的法子就让人有点耐不得烦。
  近日弄出了点花样,写在下面,与有兴趣的坛友讨论。
  以《动物世界》为例,先交代几个链接地址。

  1、节目目录页或剧集页地址

  http://ent.cntv.cn/enttv/dongwushijie/videopage/index.shtml

  2、某个节目的播放页面链接
  http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120611/100021.shtml

  3、节目目录小图片本身的链接,白色字符是与节目相关的编码(后面用到)
  http://p1.img./fmspic/2012/06/11/95b9724f41c44eee98ae5b6f5fc8f7fd-180.jpg

  4、节目信息文件链接(前半截是固定的,后半截为上面的套色部分)
  http://vdn.apps.cntv.cn/api/getHttpVideoInfo.do?pid=95b9724f41c44eee98ae5b6f5fc8f7fd
  视频节目的相关内容都在里面。

  这是第一种方法。也就是说,从某节目的小图片的地址上获得节目的“编码”,就能得到信息文件,视频节目的链接也就有了。
  有些节目的小图片的链接中没有“编码”这个内容,换个法子,从页面获取需要的内容。
  下载播放页页面文件或者用pg打开播放页页面链接,可以看到播放器这一部分的代码内容,于下。用处理字符的方法截取这一段“编码”即解决。

<script type="text/javascript">
var fo=null;
if(video_ad_channel_id=="CN22" || video_ad_channel_id=="CN23" ||video_ad_channel_id=="CN24" || video_ad_channel_id=="CN25" || video_ad_channel_id=="CN26" || video_ad_channel_id=="CN27" || video_ad_channel_id=="CN28" ||video_ad_channel_id=="CN29" || video_ad_channel_id=="CN30"){
fo = createPlayer("v_player_cctv",640,480);
}else{
fo = createCommonPlayer("v_player_cctv",640,480,tai);
}
fo.addVariable("videoId", "20120611100021");
fo.addVariable("articleId", "VIDE0020120611100021");
fo.addVariable("scheduleId", "C12278000001");
fo.addVariable("filePath", "/enttv/dongwushijie/classpage/video/");
fo.addVariable("sorts", ",,,曲艺魔杂,C12278,CCTV-1");
fo.addVariable("sysSource", "discovery");
fo.addVariable("url", "http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120611/100021.shtml");
fo.addVariable("videoCenterId","95b9724f41c44eee98ae5b6f5fc8f7fd");//视频生产中心id
fo.addVariable("channelId",channelId);//埋码
fo.addVariable("adCall",adCall);//广告
fo.addVariable("isLogin", "y");
fo.addVariable("userId", "001");
fo.addVariable("hour24DataURL", "");
fo.addVariable("isCycle", "false");
fo.addVariable("wideMode", "normal");
fo.addVariable("defaultRate", "low");
fo.addVariable("isAutoPlay", "true");
fo.addVariable("adCurtain", ad_Curtain);
fo.addVariable("adCall", ad_Call);
fo.addVariable("adPause", ad_Pause);
fo.addVariable("adAfter", ad_After);
fo.addVariable("adCorner", ad_Corner);
writePlayer(fo,"myFlash",ad_BG,ad_Roll);
</script>
<!--播放器结束-->


下面就是强盗似的一网打尽的方法。
  用pg打开目录页页面链接(第一个),里面有一段js编写的节目数组,无论这个目录页分多少页显示,所有节目都在里面。简化数组的项,示意主要内容于下。

<script language=javascript>

function c_title_array(_title,_image,_vlength,_url){
this.title=_title;
this.image=_image;

this.vlength=_vlength;
this.url=_url;
}
var c_item=new Array();
var c_itemnum = 0;

c_item[c_itemnum++]=new c_title_array('《动物世界》 20120610','http://p1.img./fmspic/2012/06/11/95b9724f41c44eee98ae5b6f5fc8f7fd-180.jpg','29:16','http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120611/100021.shtml');

c_item[c_itemnum++]=new c_title_array('《动物世界》 20120608','http://p4.img./fmspic/2012/06/08/ae9dc8cff7424e0d839bb85262de155f-180.jpg','29:14','http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120608/100092.shtml');

c_item[c_itemnum++]=new c_title_array('《动物世界》 20120607','http://p4.img./fmspic/2012/06/07/2817d5c45f4f45dc97352c98138273e9-180.jpg','28:41','http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120607/100121.shtml');

c_item[c_itemnum++]=new c_title_array('《动物世界》 20120606','http://p1.img./fmspic/2012/06/06/8fcd2fb6921c419ab5b506448a6fea70-180.jpg','28:42','http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120606/100235.shtml');

</script>

  将数组这一部分内容粘贴到一个空白页面中,在上面的js里面加上一句,于下。演示这个新页面,即显示一个包括所有节目播放页面链接的数组。你可根据自己的后续操作调整输出的数组,以方便后续制作。
  上面的数组是一个“关联数组”,俗称“哈希表”。请注意取值方式。

for(i=0;i<c_item.length;++i){
  document.getElementById("list").innerHTML += 'list['+i +'] = "'+ c_item[i].url +'";\<br\>';
}

<div id = "list">var list = [];<br></div> //用于显示输出数组,添加在<body>对象中

  显示输出的数组:
list[0] = "http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120611/100021.shtml";
list[1] = "http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120608/100092.shtml";
list[2] = "http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120607/100121.shtml";
list[3] = "http://ent.cntv.cn/enttv/dongwushijie/classpage/video/20120606/100235.shtml";

  再接下去的工作,可在flash软件中完成了。
  1、根据上面的list数组,读取每个节目的页面内容; 
  2、从页面内容中截取“编码”,拼接出信息文件的地址;
  3、从信息文件中读取需要的内容。
  这些工作都是一些重复的事情,在编程中用循环语句轻而易举的就解决了。
  程序(当然是很简单的小程序)编写调试好以后,等上一点点时间,就能得到需要的内容。央视的做法基本上差不多。往后,你就可以疯狂的转播它的节目了,几十集,一两百集都是很轻松的事。


 

吉祥如意欢迎朋友光临

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多