273286078

导航

 

脚本中未对问题进行参数化处理,关键点在于关联取值和web_add_header()函数的使用

Action()
{
    web_url("首页",
        "URL=http://qa2.cnki.net/web/",
        LAST);

    web_url("jquery-1.9.1.min.js", 
        "URL=http://qa2.cnki.net/web/Scripts/jquery-1.9.1.min.js?v=5", 
        "TargetFrame=", 
        "Resource=1", 
        "Referer=http://qa2.cnki.net/web/", 
        LAST);

    web_url("combinesearch.js", 
        "URL=http://qa2.cnki.net/web/Scripts/combinesearch.js?v=5", 
        "TargetFrame=", 
        "Resource=1", 
        "Referer=http://qa2.cnki.net/web/", 
        LAST);

    web_url("combinecss.css", 
        "URL=http://qa2.cnki.net/web/Content/combinecss.css?v=5", 
        "TargetFrame=", 
        "Resource=1", 
        "RecContentType=text/css", 
        "Referer=http://qa2.cnki.net/web/", 
        "Snapshot=t1.inf", 
        LAST);

    web_url("feedback.js", 
        "URL=http://qa2.cnki.net/web/Scripts/feedback.js?v=5", 
        "TargetFrame=", 
        "Resource=1", 
        "Referer=http://qa2.cnki.net/web/", 
        LAST);

    web_url("qakeyword.js", 
        "URL=http://kc.cnki.net/qa2.kc/Scripts/qakeyword.js?v=5", 
        "TargetFrame=", 
        "Resource=1", 
        "Referer=http://qa2.cnki.net/web/", 
        LAST);

    web_url("GetQuestions",
        "URL=http://kc.cnki.net/fb2/api/GetQuestions?size=9",
        "RecContentType=application/json",
        LAST);

    lr_start_transaction("提问");

    web_reg_save_param("RequestVerificationToken",
        "LB=<input name=\"__RequestVerificationToken\" type=\"hidden\" value=\"",
        "RB=\" /> ",
        LAST);

    web_url("query", 
        "URL=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://qa2.cnki.net/web/", 
        "Snapshot=t2.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=images/qa/cancel.jpg", "Referer=http://qa2.cnki.net/web/Content/combinecss.css?v=5", ENDITEM, 
        LAST);

    lr_output_message(lr_eval_string("{RequestVerificationToken}"));

    lr_save_string(lr_eval_string("{RequestVerificationToken}"),"__RequestVerificationToken");

    web_add_header("__RequestVerificationToken",lr_eval_string("{__RequestVerificationToken}"));

    web_add_header("X-Requested-With","XMLHttpRequest");

    web_url("result_sg", 
        "URL=http://qa2.cnki.net/web/query/result_sg?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&c=30&cp=1&navc=0&t=0.9310036083981132", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", 
        "Snapshot=t3.inf", 
        "Mode=HTML", 
        EXTRARES, 
        "Url=http://kc.cnki.net/qa2.kc/api/KeyWord?appid=qa&UserID=b970cb5c-7f25-ae8e-7e97-26a6ddaca2c3&refer=http://qa2.cnki.net/web/&ip=103.26.1.99&word={%22q%22:%22%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B%22,%22browser%22:%22FF%22}&callback=jQuery191015277632355267712_1511397963150&_=1511397963151", "Referer=http://qa2.cnki.net/web/query?q="
        "%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", ENDITEM, 
        "Url=/qa.r//api/GetRecommended?source=fb_question&threshold=50&content=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B", "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", ENDITEM, 
        "Url=/qa.r//api/GetRecommended?source=KbaseFAQ&threshold=50&content=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B", "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", ENDITEM, 
        "Url=../images/qa/spirit.png", "Referer=http://qa2.cnki.net/web/Content/combinecss.css?v=5", ENDITEM, 
        "Url=http://kc.cnki.net/fb2/api/GetNewQuestion?size=10", "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", ENDITEM, 
        "Url=http://kc.cnki.net/fb2/api/GetHotQuestion?size=10", "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", ENDITEM, 
        "Url=../Images/dy.png", "Referer=http://qa2.cnki.net/web/Content/combinecss.css?v=5", ENDITEM, 
        LAST);

    web_add_header("__RequestVerificationToken",lr_eval_string("{__RequestVerificationToken}"));

    web_add_header("X-Requested-With","XMLHttpRequest");

    web_url("result_kb", 
        "URL=http://qa2.cnki.net/web/query/result_kb?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&t=0.09500854284992843", 
        "TargetFrame=", 
        "Resource=0", 
        "RecContentType=text/html", 
        "Referer=http://qa2.cnki.net/web/query?q=%E5%85%B3%E4%BA%8E%E4%BA%92%E8%81%94%E7%BD%91%E6%8A%80%E6%9C%AF%E6%96%B9%E9%9D%A2%E4%BC%98%E5%85%88%E6%9C%9F%E5%88%8A%E6%9C%89%E5%93%AA%E4%BA%9B&r=query&t=0.14502917438024598", 
        "Snapshot=t4.inf", 
        "Mode=HTML", 
        LAST);

    web_url("GetEvaluate",
        "URL=http://kc.cnki.net/fb2/api/GetEvaluate",
        "RecContentType=application/json",
        LAST);

    lr_end_transaction("提问",LR_AUTO);

    return 0;
}

 

posted on 2017-11-23 10:44  273286078  阅读(251)  评论(0编辑  收藏  举报