static function OnBeforeResponse(oSession: Session) {
if (m_Hide304s && oSession.responseCode == 304) {
oSession["ui-hide"] = "true";
}
if (oSession.uriContains("/webcast/ranklist/room/")){
var strBody=oSession.GetResponseBodyAsString();
var jsonbody = eval('(' + strBody + ')');
var json = jsonbody.data.ranks;
//FiddlerObject.alert(json['1']['user'].nickname);
for(var i=0; i<json.length; i++)
{
var zburl=oSession.url;
var room_id = zburl.match(/(?<=(&room_id=))[0-9]*/g);
var rank=json[i].rank;//直播间排名
var score=json[i].score;//直播间音浪
var uid=json[i]['user'].id;//用户ID
var nicname=json[i]['user'].nickname;//用户昵称
var nicname=nicname.replace("[^\u4e00-\u9fa5a-zA-Z0-9]", "");
//FiddlerObject.log("【直播"+i+"】直播间ID:"+room_id+" 排行:"+json[i].rank+" 音浪:"+json[i].score+" 昵称:"+json[i]['user'].nickname);
var method = "POST";
var myUrl = 'http://www.xxxx.com/dyidadd.php'
var url = myUrl+'?type=live&room_id='+room_id+'&dyid='+uid+'&nicname='+Utilities.UrlEncode(nicname)+'&rank='+rank+'&score='+score;
var protocol = "HTTP/1.1";
var raw="";
var selected: Session = oSession;
raw += method + " " + url + " " + protocol + "\r\n";
raw +="Host:www.xxxx.com\r\n";
raw +="Connection: Close\r\n";
raw +="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n";
raw +="User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36\r\n";
raw +="Accept-Encoding: gzip,deflate,sdch\r\n";
raw +="Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4\r\n";
raw +="Content-Type: application/json\r\n";
var body= "jsondata=''";
raw += "\r\n" + body;
FiddlerObject.utilIssueRequest(raw);
}
}
if (oSession.uriContains("/aweme/v2/comment/list/")){
var strBody=oSession.GetResponseBodyAsString();
var jsonbody = eval('(' + strBody + ')');
var json = jsonbody.comments;
//FiddlerObject.alert(json['1']['user'].uid);
for(var i=0; i<json.length; i++)
{
var uid=json[i]['user'].uid;
var unique_id=json[i]['user'].unique_id;
var nicname=json[i]['user'].nickname;
var nicname=nicname.replace("[^\u4e00-\u9fa5a-zA-Z0-9]", "");
var signature=json[i]['user'].signature;
var signature = signature.replace("[^\u4e00-\u9fa5a-zA-Z0-9]", "");
var signature = signature.replace(/\\n/g,'');
var text=json[i].text;
var text = text.replace("[^\u4e00-\u9fa5a-zA-Z0-9]", "");
var text = text.replace(/\\n/g,'');
var digg_count=json[i].digg_count;
var is_author_digged=json[i].is_author_digged;
// FiddlerObject.log("【评论"+i+"】用户:"+json[i]['user'].nickname+" 评论了:"+json[i].text);
if(is_author_digged == false){var is_author_digged=0;}else{var is_author_digged=1;}
var aweme_id=json[i].aweme_id;
var reply_comment=json[i].reply_comment;
if(reply_comment == null){var reply_comment=0;}else{var reply_comment=1;}
var create_time=json[i].create_time;
// FiddlerObject.utilIssueRequest(s);
var method = "POST";
var myUrl = 'http://www.xxxx.com/dyidadd.php'
var url = myUrl+'?type=comment&aweme_id='+aweme_id+'&dyid='+uid+'&nicname='+Utilities.UrlEncode(nicname)+'&text='+Utilities.UrlEncode(text)+'&signature='+Utilities.UrlEncode(signature)+'&digg_count='+digg_count+'&unique_id='+unique_id+'&is_author_digged='+is_author_digged+'&reply_comment='+reply_comment+'&create_time='+create_time;
var protocol = "HTTP/1.1";
var raw="";
var selected1: Session = oSession;
raw += method + " " + url + " " + protocol + "\r\n";
raw +="Host:www.xxxx.com\r\n";
raw +="Connection: Close\r\n";
raw +="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n";
raw +="User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.122 Safari/537.36\r\n";
raw +="Accept-Encoding: gzip,deflate,sdch\r\n";
raw +="Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.6,en;q=0.4\r\n";
raw +="Content-Type: application/json\r\n";
var body= "jsondata=''";
raw += "\r\n" + body;
//if(reply_comment == 0){
FiddlerObject.utilIssueRequest(raw);
//}
}
fiddler数据包处理实时推送直播间及评论区数据脚本
最新推荐文章于 2024-01-26 17:51:15 发布