1、准备工具
抓包工具:firebug或httpwatch,这里我使用firebug。它是火狐自带的组件,如果浏览顺上没有可以在【工具--》附加组件--》搜索fireug安装即可】。
谷歌浏览器
记事本
2、以优酷、腾讯的例子为例。
优酷
访问优酷www.youku.com,随便找了个视频,标题是:违法司机强行开车冲撞执勤交警 被拘十日
地址:http://v.youku.com/v_show/id_XNTM2MTQ5MDcy.html
打开firebug,【网络--》选择HTML】,然后访问视频上述视频地址。此时firebug会记录的有get与post请求!如图:
待视频播放后(广告结束后,播放视频),立即点击【保持】并且暂停视频。这时候开始分析所有URL。
视频播放前,前台页面肯定会发请求给CDN服务器,来获取真实的视频源地址,从而进行播放!一般地,只需要查看所有GET请求的URL就行了。
仔细分析你会发现http://v.youku.com/player/getPlayList/VideoIDS/XNTM2MTQ5MDcy/timezone/+08/version/5/source/video?n=3&password=&ran=5169,这个URL特别可疑!
为什么可疑?我是这么想的:
1、域名现视频地址的域名一样,都是v.youku.com,其他PHP大多是系统去获取广告信息的,你可以点击看一下的。
2、大的视频网站命名都比较规范,只要跟播放相关都带有player、video等字眼。
3、另外链接有一个加密参数XNTM2MTQ5MDcy,这个与链接地址一样 ,说明它通过此链接要获取什么。
打开这个链接看看,如图:
{"data":[{"ct":"a","cs":"2148","logo":"http:\/\/g1.ykimg.com\/1100401F46515941D0D0DB06B0AAF678F1AC95-3C68-2DBD-E0BA-F481AE482872","seed":657,"tags":["\u4ea4\u8b66","\u60e0\u5dde","\u62d8\u7559","\u6297\u6cd5"],"categories":"91","videoid":"134037268","vidEncoded":"XNTM2MTQ5MDcy","username":"\u60e0\u5dde\u4ea4\u8b66\u652f\u961f","userid":"112241398","title":"[\u62cd\u5ba2]\u8fdd\u6cd5\u53f8\u673a\u5f3a\u884c\u5f00\u8f66\u51b2\u649e\u6267\u52e4\u4ea4\u8b66 \u88ab\u62d8\u5341\u65e5","up":0,"down":0,"ts":"ac1uOzJtl7k4j6VaAQta-lg","tsup":"ac1p0jFtl7k4j6VaAuJd-lg","key1":"bd72daaf","key2":"45348866156cb4ce","tt":"0","dvd":{"notsharing":"0"},"videoSource":"1","seconds":"29.16","streamfileids":{"hd2":"18*20*18*18*18*12*18*12*18*18*63*12*63*3*16*7*16*49*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*","mp4":"18*20*18*18*18*47*18*12*18*18*63*12*63*3*16*7*66*48*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*","flv":"18*20*18*18*18*7*18*12*18*18*63*12*63*3*20*48*20*47*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*"},"segs":{"hd2":[{"no":0,"size":"4392161","seconds":"29","k":"13f5916b4efbcfe6261ced07","k2":"18e16491ec1e955f0"}],"mp4":[{"no":0,"size":"2021160","seconds":"29","k":"53fb686911e6a22528287f0a","k2":"104f0f45d3d852c1f"}],"flv":[{"no":0,"size":"1057307","seconds":"29","k":"4b385afbc4e2f85228287f0a","k2":"1bda9288b811758f8"}]},"streamsizes":{"hd2":"4392161","mp4":"2021160","flv":"1057307"},"stream_ids":{"hd2":"123282938","mp4":"123283293","flv":"123280152"},"streamlogos":{"hd2":"1","mp4":"1","flv":"1"},"streamtypes":["hd2","mp4","flv"],"streamtypes_o":["hd2","flvhd","mp4"]}],"user":{"id":0},"controller":{"search_count":true,"mp4_restrict":1,"stream_mode":1,"video_capture":true,"hd3_enabled":false,"area_code":110000,"dma_code":64495,"continuous":1,"playmode":"normal","circle":false,"tsflag":false,"share_disabled":false,"download_disabled":false,"pc_disabled":false,"pad_disabled":false,"mobile_disabled":false,"tv_disabled":false}}
会看到所有DATA信息,一般这些信息的中文都是unicode编码!肉眼无法识别,网上有很多在线转换工具,随便Google一下就能找到。
复制所有信息,在这里转一下:http://www.guabu.com/zhuanma/。
{"data":[{"ct":"a","cs":"2148","logo":"http:\/\/g1.ykimg.com\/1100401F46515941D0D0DB06B0AAF678F1AC95-3C68-2DBD-E0BA-F481AE482872","seed":657,"tags":["交警","惠州","拘留","抗法"],"categories":"91","videoid":"134037268","vidEncoded":"XNTM2MTQ5MDcy","username":"惠州交警支队","userid":"112241398","title":"[拍客]违法司机强行开车冲撞执勤交警 被拘十日","up":0,"down":0,"ts":"ac1uOzJtl7k4j6VaAQta-lg","tsup":"ac1p0jFtl7k4j6VaAuJd-lg","key1":"bd72daaf","key2":"45348866156cb4ce","tt":"0","dvd":{"notsharing":"0"},"videoSource":"1","seconds":"29.16","streamfileids":{"hd2":"18*20*18*18*18*12*18*12*18*18*63*12*63*3*16*7*16*49*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*","mp4":"18*20*18*18*18*47*18*12*18*18*63*12*63*3*16*7*66*48*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*","flv":"18*20*18*18*18*7*18*12*18*18*63*12*63*3*20*48*20*47*18*63*16*48*18*38*51*18*66*66*1*38*20*47*47*7*38*66*8*66*25*3*48*20*12*25*49*49*8*7*25*48*47*66*47*25*66*48*3*11*7*7*48*48*20*16*18*51*"},"segs":{"hd2":[{"no":0,"size":"4392161","seconds":"29","k":"13f5916b4efbcfe6261ced07","k2":"18e16491ec1e955f0"}],"mp4":[{"no":0,"size":"2021160","seconds":"29","k":"53fb686911e6a22528287f0a","k2":"104f0f45d3d852c1f"}],"flv":[{"no":0,"size":"1057307","seconds":"29","k":"4b385afbc4e2f85228287f0a","k2":"1bda9288b811758f8"}]},"streamsizes":{"hd2":"4392161","mp4":"2021160","flv":"1057307"},"stream_ids":{"hd2":"123282938","mp4":"123283293","flv":"123280152"},"streamlogos":{"hd2":"1","mp4":"1","flv":"1"},"streamtypes":["hd2","mp4","flv"],"streamtypes_o":["hd2","flvhd","mp4"]}],"user":{"id":0},"controller":{"search_count":true,"mp4_restrict":1,"stream_mode":1,"video_capture":true,"hd3_enabled":false,"area_code":110000,"dma_code":64495,"continuous":1,"playmode":"normal","circle":false,"tsflag":false,"share_disabled":false,"download_disabled":false,"pc_disabled":false,"pad_disabled":false,"mobile_disabled":false,"tv_disabled":false}}
看到没有,title标题,标签与视频的标题一样,说明这个文件内容绝对有用!