一、进入Fiddler
1.选择工具,首选项;
2.规格:取消更新
3.选择HTTPS,点击操作Actions,点击重置所有证书Reset All Certificates;然后弹窗一直点击‘是’;
4.勾上这两项:忽略服务器证书错误;检查证书吊销;
5.点击Connections;设置端口号;允许远程连接;然后点击ok保存;重启Fiddler;
6.点击FiddlerScript;导入包;GoTo选择第一项OnBeforeRequest;
import System.Text.RegularExpressions;
7.将这两段代码加入,①方法写在方法外面,②if写在方法里面;GoTo选择第二项OnBeforeResponse;
①
public static RulesOption("捕获blv")
BindPref("fiddlerscript.rules.BLV")
var m_isBLV: boolean = false;
②
if(m_isBLV && oSession.fullUrl.Contains("https://hls.videocc.net/playsafe") && oSession.fullUrl.Contains("key")){
oSession.fullUrl = oSession.fullUrl.Replace("/playsafe","");
}
8.在OnBeforeReseponse里面加入这段代码;点击Save Script;
if(m_isBLV){
if(oSession.fullUrl.Contains("https://hls.videocc.net") && oSession.fullUrl.Contains("m3u8")){
oSession.utilDecodeResponse();
var body = oSession.GetResponseBodyAsString();
if(body.IndexOf("#EXT-X-STREAM-INF")!=-1){
var m3u8Url = oSession.fullUrl;
var baseUrl = oSession.fullUrl.Substring(0,oSession.fullUrl.IndexOf(".m3u8"))
var r = new Regex('_(.*?desktop)');
FiddlerObject.log(body);
var mc = r.Match(body);
if(mc.Groups[1].Value == ""){
//没有匹配到,不再执行后面的代码
FiddlerObject.log("[异常]:获取m3u8Url正则失败,请联系开发者QQ:2908436596");
return;
}
var dUrl = mc.Groups[1].Value;
var m3u8Data = baseUrl +"_"+ dUrl;
FiddlerObject.log("成功获取最高清晰度m3u8URL为:");
FiddlerObject.log(m3u8Data)
}
}
}
if(m_isBLV && oSession.fullUrl.Contains("hls.videocc.net") && oSession.fullUrl.Contains("key?token") ){
FiddlerObject.log(Fiddler.Utilities.ByteArrayToString(oSession.ResponseBody))
var keyBytes = Fiddler.Utilities.ByteArrayToString(oSession.ResponseBody)
var base64Data = Convert.ToBase64String(oSession.ResponseBody)
FiddlerObject.log("base64:"+base64Data)
}