LOL 战斗力查询

LOL(英雄联盟) 战斗力查询

接口:http://lolbox.duowan.com/playerDetail.php?serverName=serverName&playerName=playerName

通过多玩的lol战斗力查询,将返回的页面信息,解析出来。


这里解析html用到了HTML Parser,可自行度娘下载


实现:

比如:http://lolbox.duowan.com/playerDetail.php?serverName=艾欧尼亚&playerName=请叫我中路杀神


返回的HTML如下:

</head>
<body  scroll='no'>
<div class="box">
    <div class="box-hd">
    <div class="fl crumbs"><div style='float:left;'><a href="playerSearch.php">首页</a><span>></span><a href="playerDetail.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E">请叫我中路杀神(艾欧尼亚)</a><span>></span>个人信息</div>
   </div>
    <div style="float:left;margin-left:10px"> 
     
   </div>
    <!--分享模块 start -->
    <div class="btns-fast">
			<a title="返回" href="javascript:history.back();" onfocus="this.blur();" class="icons"><i></i></a>
			<div class="share">
				<a class="icons" href="#"><i></i></a>
				<div class="links">
					<a class="button_tsina" href="#"><span>新浪微博</span></a>
					<a class="button_tqq" href="#"><span>腾讯微博</span></a>
					<a class="button_qzone" href="#"><span>QQ空间</span></a>
					<a class="screenshot" href="javascript:screenshot();"><span>本页截图</span></a>
					<a class="copy-link" href="javascript:window.clipboardData.setData('Text',window.location.href);alert('链接复制成功');"><span>复制链接</span></a>
				</div>
			</div>
				<script type="text/javascript" src="js/sns_share.js?v=2012091201" charset="utf-8"></script>
				<script type="text/javascript">
				var playerMostUsedHero = null;
				playerMostUsedHero = "Yasuo";				var jiathis_config= {
						title: "#无盒子 不开撸# 我是请叫我中路杀神,我在使用LOL盒子。来看看我的战斗力有多少吧!",
						appkey: {
					        "tsina":"3629014272",
					        "tqq":"801220649",
					        "qzone":"100302822"
					    },
					    summary:" ",
					    ralateuid:{
					        "tsina":"2909042820"
					    }
				};
				if (playerMostUsedHero)
					jiathis_config.pic = 'http://lolbox.duowan.com/images/champions/' + playerMostUsedHero + '_120x120.png';
				if (SnsShare) SnsShare.init();
				</script>
				<a title="刷新" class="icons refresh"  onfocus="this.blur();" href="javascript:location.reload();"><i></i></a>
		</div>
		<script>
			function screenshot() {
				$('.share').removeClass('hover');
				setTimeout(function() {
					window.location.href='lolboxphoto://电信一_请叫我中路杀神_玩家详情';
				}, 200);
			}
			$('.box .box-hd .btns-fast .share').hover(function(){
				$(this).addClass('hover');
			},function(){
				$(this).removeClass('hover');
			});
		</script>
   <!--分享模块 end -->
</div>
  <div class="box-bd">
    <div class="intro">
      <div class="avatar">
            <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E"><img src="http://img.lolbox.duowan.com/profileIcon/profileIcon25.jpg" /></a>
            <span></span>
	  <em>30</em>
      </div>
      <div class="text">
        <div>
       		<strong>
       				        	<a id="playerNameLink" href="playerDetail.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E" title="请叫我中路杀神">请叫我中路杀神</a>
	        	<a title="扫描二维码" href="qrcode.php?openmode=barcode&serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E" target="_blank"><img alt="扫描二维码" src="images/barcode.png?v=3"></a>
	        						        </strong>
        </div>  
       <div title="此玩家在游戏中被队友给的好评数,只有使用lol盒子的玩家才可以进行评价">被赞 66 次</div>
        					<div title="此玩家在游戏中被多少人拉黑,只有使用lol盒子的玩家才可以进行拉黑操作">被拉黑 8 次</div>			
			      </div>
      <div class="fighting" title='点击查看战斗力详细计算方法'>
        <p> <strong><a href='http://lol.duowan.com/1112/187633871943.html?&openmode=default' target='_blank' style='color:white;cursor: help;'>战斗力</a></strong> </p>
        <p><em><span title='更新时间:2014-05-13 10:27:20'>11884</span></em></p>
      </div>
    </div>
    <div class="com-hero">
        <h3>最近常用英雄 
    	    	<span style="font-weight:normal;margin-left:20px">
    	<!-- <a href="http://lolbox.duowan.com/heroesRank.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E">高手出装</a> --></span>
    		</h3>
      <ul class="mod-pic">								 <li> <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E&hero=Yasuo"> <img src="http://img.lolbox.duowan.com/champions/Yasuo_40x40.jpg" alt="疾风剑豪 12 次 点击查看相关比赛"  title="疾风剑豪 12次"></a></li>
				     								 <li> <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E&hero=TwistedFate"> <img src="http://img.lolbox.duowan.com/champions/TwistedFate_40x40.jpg" alt="卡牌大师 5 次 点击查看相关比赛"  title="卡牌大师 5次"></a></li>
				     								 <li> <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E&hero=Zed"> <img src="http://img.lolbox.duowan.com/champions/Zed_40x40.jpg" alt="影流之主 5 次 点击查看相关比赛"  title="影流之主 5次"></a></li>
				     								 <li> <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E&hero=Nidalee"> <img src="http://img.lolbox.duowan.com/champions/Nidalee_40x40.jpg" alt="狂野女猎手 4 次 点击查看相关比赛"  title="狂野女猎手 4次"></a></li>
				     								 <li> <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E&hero=Ezreal"> <img src="http://img.lolbox.duowan.com/champions/Ezreal_40x40.jpg" alt="探险家 4 次 点击查看相关比赛"  title="探险家 4次"></a></li>
				           </ul>
    </div>
    <div id="tab1" class="mod-tabs">
      <div class="mod-tabs-hd">
        <ul class="mod-tabs-trigger J_nav">
          <li class="selected">匹配模式</li>
          <li onclick="loadRankedData('请叫我中路杀神', '电信一');">S4排位赛</li>
          <li onclick="loadEloRanks('请叫我中路杀神', '电信一');">战斗力评估</li>
          <li id="nav_wan" style="color:#FF0000; font-weight:500;" class="hide">大神陪玩</li>
          <!-- <li onclick="loadEloRanks('', '');">本服排名</li>         -->
        </ul>
        <div class="act"><!-- <a title="请使用盒子打一场对应类型的比赛,即可更新您这种类型比赛的战绩数据,也能部分修正战斗力突然降低的问题" style="cursor: help;">数据不对?</a>   --> 
        	<!-- <a href="http://fankui.duowan.com/knowledgebase/articles/193131" target="_blank">数据不对?</a> -->
        	 
        	 

    	</div>
      </div>

      <div class="mod-tabs-bd J_content">
        <div class="mod-tabs-content">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <th scope="col">类型</th>
              <th scope="col">总场次</th>
              <th scope="col">胜率</th>
              <th scope="col">胜场</th>
              <th scope="col">负场</th>
              <th scope="col" style="width:100px">更新时间</th> 
            </tr>  
                       <tr>
              <td>经典模式</td>
              <td>
              310</td>
              <td>70%</td>
              <td>217</td>
              <td>93</td>
              <td>03-21 16:29</td>
              
            </tr>
                        <tr>
              <td>大乱斗</td>
              <td>
              13              </td>
              <td>61.5%</td>
              <td>8</td>
              <td>5</td>
              <td>03-21 00:57</td>
            </tr>
                        
          </table>
        </div>

        <div class="mod-tabs-content hide">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <th scope="col">类型</th>
              <th scope="col">段位/级别</th>
              <th scope="col">胜点</th>
              <th scope="col">总场次</th>
              <th scope="col">胜率</th>
              <th scope="col">胜场</th>
              <th scope="col">负场</th>
              <th scope="col" style="width:100px">更新时间</th>
              <!-- <th scope="col">逃跑</th> -->
              <!-- <th scope="col" title="所有赛季的总胜场">全赛季胜场</th>   -->     
            </tr>
                         <tr>
             <td>5v5单双排</td> 
             <td id="ranked_tier">-</td> 
             <td id="ranked_league_points">-</td> 
             <td>
	              120	             </td>
	              <td>55%</td>
	              <td>66</td>
	              <td>54</td>
				  <td>04-26 15:25</td>      
	              <!-- <td></td> -->
	          <!-- <td></td> -->                                         
            </tr>

            <tr><td align="center">S1+S2+S3排位 :</td><td></td><td></td><td>410</td><td>61%</td><td>254</td><td>156</td></tr>          </table>
        </div>
                  <div class="mod-tabs-content hide">
          <div class="combat-assess">
              <p class="info">
                <!-- <a href='http://lol.duowan.com/1301/222445786585.html' target='_blank' style='cursor: help;'>区间说明</a> -->
                <!-- <a href="#">丨</a> -->
                <a href='http://fankui.duowan.com/knowledgebase/articles/208098?&openmode=default' target='_blank' style='cursor: help;'>算法</a>
                11884 = 6874(基础分) + 3515(胜率分) + 1495(胜场分)
                本服战斗力排名:<span id="zdlRank"></span>              </p>              <div class="combat-assess-content">
              	<p style="padding-left:50px;padding-top:5px;color:red">请通过排位赛来提升个人战斗力</p>
                <p class="less-than-tip"><a target="_blank" href="http://fankui.duowan.com/knowledgebase/articles/208098?&openmode=default">2014赛季战斗力算法详细解释</a></p>
              </div>
                            <!-- 战斗力评价{ -->
              <!--<div class="combat-assess-content ">
              	                     <div class="combat-progress-bar">
                    <div style="width:px;" class="player-progress">
                    	<i class="down-arrow" style="display: block;"></i><i class="up-arrow" style="display: block;"></i>
                    </div>
                    
                    <div id="player-fighting-power" style="; display: block;">
                          <p><b></b></p>
                    </div>
                                        <div id="level-" class="level-tips" style="visibility: hidden;">
                          <p></p>
                    </div>
                	                    <i class="level-tips-arrow" style="display: none; left: 365px;"></i>
                    <i class="level-tip-1">2600</i>
                    <i class="level-tip-2">3500</i>
                    <i class="level-tip-3">4400</i>
                    <i class="level-tip-4">5900</i>
                    <i class="level-tip-5">7000</i>
                    <i class="level-tip-6">9900</i>
                  </div>
              	
              </div>-->
              <!-- }战斗力评估 -->
              <script>
                $(function(){
                  // var $playerTip    = $("#player-fighting-power");
                  // var _tipWidth     = $playerTip.outerWidth();
                  // var _barWidth     = $(".player-progress").width();
                  // var _barOverWidth = $(".combat-progress-bar").width() - _barWidth;
                  // if(_barWidth >= _tipWidth/2 && _barOverWidth > _tipWidth/2){
                  //   $playerTip.css({"left":_barWidth - _tipWidth/2});
                  // }else if(_barWidth <= _tipWidth/2 && _barOverWidth > _tipWidth/2){
                  //   $playerTip.css({"left":"0"});
                  // }else if(_barWidth > _tipWidth/2 && _barOverWidth <= _tipWidth/2){
                  //   //$("#player-fighting-power").css({"left":(_barOverWidth + _barWidth) - _tipWidth});
                  //   $playerTip.css({"left":"auto","right":"0"});
                  // }

               //  $(".combat-progress-bar").on('mousemove', function(event){
               //    $("#player-fighting-power").hide();
               //    $("i.down-arrow,i.up-arrow").hide();
               //    var _x = event.pageX - $(this).offset().left;
               //    if( _x > 5 && _x <= 585){
               //      $("i.level-tips-arrow").show().css({"left":_x});
               //    }
               //    if( _x >0 && _x <= 56){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-1").css({"visibility":"visible","left":"0"});
               //    }else if(_x >56 && _x <= 272){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-2").css({"visibility":"visible","left":"0"})
               //    }else if(_x >272 && _x <= 408){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      var _tipWidth = Math.round($("#level-3").outerWidth() / 2);
               //      $("#level-3").css({"visibility":"visible","left":"50%","margin-left":-_tipWidth})
               //    }else if(_x >408 && _x <= 493){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-4").css({"visibility":"visible","right":"0"})
               //    }else if(_x >493 && _x <= 539){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-5").css({"visibility":"visible","right":"0"})
               //    }else if(_x >539 && _x <= 575){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-6").css({"visibility":"visible","right":"0"})
               //    }else if(_x >575 && _x <= 600){
               //      $(".level-tips").css({"visibility":"hidden"});
               //      $("#level-7").css({"visibility":"visible","right":"0"})
               //    }
               //  });

               //  $(".combat-progress-bar").mouseout(function(){
               //    $("#player-fighting-power").show();
               //    $("i.down-arrow,i.up-arrow").show();
               //    $("i.level-tips-arrow").hide();
               //    $(".level-tips").css({"visibility":"hidden"});
               // });
                })
              </script>
          	              </div>
        </div>
                  
        <!-- <div class="mod-tabs-content hide">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
             <th scope="col">战斗力</th>
              <th scope="col">单双排5V5</th>
              <th scope="col"></th>   
            </tr>
            <tr>
           		<td id="zdlRank"></td>
            	<td id="eloRanksRS5"></td>
             	<td></td>        	           
            </tr>
        	             <tr>
           		<td colspan="3"><p class="note" style="color: #999999">目前仅显示战斗力大于5000的玩家的排名数据、且最多显示前5万名。</p></td>  
            </tr>
        	          </table>
        </div> -->
         <div class="mod-tabs-content hide" id="content_wan">
			 loading
		 </div>
      </div>
    </div>
    <script>
          KISSDW.tabs("#tab1");
    </script>
    <div class="clearfix">
      <div class="recent bd-r fl">
        <div class="recent-hd">
          <h3>最近比赛</h3>
                    <a href="matchList.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E">更多战报>></a>
      	      </div>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <th scope="col">英雄</th>
            <th scope="col">模式</th>
            <th scope="col">结果</th>
            <th scope="col">时间</th>
          </tr>
          						<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/Sion_24x24.jpg" title="亡灵勇士" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="green">胜利</em></td>
				            <td>05-03 16:05				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/TwistedFate_24x24.jpg" title="卡牌大师" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="green">胜利</em></td>
				            <td>05-02 14:40				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/Mordekaiser_24x24.jpg" title="金属大师" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="green">胜利</em></td>
				            <td>04-29 19:24				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/Sion_24x24.jpg" title="亡灵勇士" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="green">胜利</em></td>
				            <td>04-28 14:35				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/MasterYi_24x24.jpg" title="无极剑圣" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="red">失败</em></td>
				            <td>04-26 15:25				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/MasterYi_24x24.jpg" title="无极剑圣" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="red">失败</em></td>
				            <td>04-26 14:44				            </td>
				          </tr>
											<tr>
				            <td><img  src="http://img.lolbox.duowan.com/champions/Zed_24x24.jpg" title="影流之主" alt=""></td>
				            <td>排位赛</td>
				            <td><em class="red">失败</em></td>
				            <td>04-26 14:01				            </td>
				          </tr>
					        </table>
      </div>
		<div class="recent fr">
	        <div class="recent-hd" style="color:red">
	        		           <!-- <h3>LOL迷你盒子</h3> -->
	         <!-- <a href="qrcode.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E" target="_blank">二维码扫描</a> -->
			</div>
			<div id="a3Ad" class="td-code clearfix" style="padding:6px 0 0 12px;">
				<!-- <a href="http://torchforgaming.org/cn/?<ype=ad" target="_blank">
			        <img src="images/ad/290-210.jpg" />
			    </a> -->
			    <script src="http://market.duowan.com/duowan/227029561269.js"></script>
		        <!-- <div class="pic" style="width:125px;">
		          <img src="images/ad/mini_hezi.png" style="width:125px;" alt="LOL盒子" />
		        </div>
		        <p>* 游戏读条摇出对阵信息</p>
		        <p> </p>
				<p>* 英雄介绍出装配音皮肤</p>
				<p> </p>
				<p>* 论坛、最新动态、攻略</p>
				<p> </p>
		        <p><a href="http://lol.duowan.com/hezi/m" target="_blank" class="btn">盒子Android版</a></p> -->
		    </div>
		    <!--
			<div class="record clearfix" style="width:314px;">
					<ul class="clearfix">
		                <li><i class="sub_head sub_head1"></i><em class="sub_name">战斗力</em><br>
		              			            </ul>
       				<p class="note">目前仅显示10万名以内的排名数据。</p>
       				<p style="text-align: center; border: 1px solid rgb(221, 221, 221); padding: 5px; width: 90%; margin: 10px 0px 0px 15px;"><a href="http://lol.duowan.com/hezi/m/?ltype=ad" target="_blank" style="font-weight:bold">LOL迷你盒子</a>:手机逛论坛、加载时摇出对阵信息</p>

				</div>-->
	 </div>
    </div>
  </div>
</div>

<div id="__dvCompute" style="font-size:12px;position:absolute;visibility:hidden"></div>
<script type="text/javascript">
function StrRangeCompute(str) {
	var d = document.getElementById('__dvCompute');
	d.innerHTML = str;
	return { w: d.offsetWidth, h: d.offsetHeight };
}
function normalizePlayerName(playerName) {
	var maxWidth = 96;
	var range = StrRangeCompute(playerName);
	if (range.w > maxWidth) {
		var p = playerName[0];
		for (var i = 1; i < playerName.length; i++) {
			var _range = StrRangeCompute(p + playerName[i])
			if (_range.w > maxWidth)
				return p + '...';
			else
				p = p + playerName[i];
		}
	}
	return playerName;
}
var playerName = $('.intro #playerNameLink').text();
if (playerName)
	$('.intro #playerNameLink').text(normalizePlayerName($('.intro #playerNameLink').text()));
</script>

<script type="text/javascript">_hiido_no=0;_hiido_wid=["lbox"];</script>
<script>
function getCookie(cookieName) 
{
	  var cookieString = document.cookie;
	  var start = cookieString.indexOf(cookieName + '=');
	  // 加上等号的原因是避免在某些 Cookie 的值里有
	  // 与 cookieName 一样的字符串。
	  if (start == -1) // 找不到
	    return null;
	  start += cookieName.length + 1;
	  var end = cookieString.indexOf(';', start);
	  if (end == -1) 
	  	return cookieString.substring(start);
	   return   cookieString.substring(start, end);
}
function beenBlockedTimes(action)
{
      var boxPlayerName=decodeURI(getCookie('boxPlayerName'));
      var boxServerName=decodeURI(getCookie('boxServerName'));
      //alert(action + boxServerName + boxPlayerName);
	  $.ajax(
		{
		  url: "webApi.php",
		  data:{serverName:boxServerName,playerName:boxPlayerName,action:action},
		  cache:false,
		  success: function(msg){
		  //	alert(msg);
	        if(msg == 1){
				location.reload();
				
	        }else if(msg == -1){
			     alert('非法操作,请至少登陆一次游戏!');
            }
            
		   },
		  error:function(){
			}
		});	
}


function focusPlayers(targetServerName,targetPlayerName,action)
{
	 var boxPlayerName=decodeURI(getCookie('boxPlayerName'));
     var boxServerName=decodeURI(getCookie('boxServerName'));
     $.ajax(
		{
		  url: "webApi.php",
		  data:{serverName:boxServerName,playerName:boxPlayerName,targetServerName:targetServerName,targetPlayerName:targetPlayerName,action:action},
		  cache:false,
		  success: function(msg){
	        if(msg == '11'){
				location.reload();
				
	        }else if(msg == -1){
			     alert('非法操作,请至少登陆一次游戏!');
            }
            
		   },
		  error:function(){
			}
		});	
}

var playerEloRanksLoaded = false;

function loadEloRanks(playerName, serverName) {
	if (playerEloRanksLoaded == true)
		return;

	$.getJSON('ajaxGetPlayerEolRanks.php', {playerName:encodeURIComponent(playerName), serverName:encodeURIComponent(serverName)}, function(data){
        if(data){
			$('#zdlRank').text(data.zdlRank ? '第' + data.zdlRank + '位' : '无');
			$('#eloRanksRS5').text(data.eloRanks.R_S_5 ? '第' + data.eloRanks.R_S_5 + '位' : '无');
        }
    });

	playerEloRanksLoaded = true;
}
var playerRankedDataLoaded = false;
function loadRankedData(playerName, serverName) {
	if (playerRankedDataLoaded == true)
		return;
	$.getJSON('ajaxGetWarzone.php', {playerName:encodeURIComponent(playerName), serverName:encodeURIComponent(serverName)}, function(data){
        if(data){
        	var text = data.tier == null ? "":data.tier;
        	text += (data.tier == null || data.rank == null) ? "":"/"; 
        	text += data.rank == null ? "":data.rank;
        	text = text == "" ? "-":text;
			$('#ranked_tier').html('<span title="更新时间:' + data.warzone_updated + '">' + text + '</span>');
			if (data.league_points)
				$('#ranked_league_points').text(data.league_points);
        }
    });

	playerEloRanksLoaded = true;
}
</script>
<script>var stat_app_name = "boxgame_playerdetail"; var stat_uid = ""; var stat_oper_default = false; </script>
<script src="http://assets.dwstatic.com/amkit/entry.js"></script>
<script>
seajs.use("p/statistics/main", function() {
	$('#a3Ad a').each(function() {
		if (!$(this).attr('data-stat')) return;
		var words = $(this).attr('data-stat').split('_');
		words[2] += '展示';
		webUserOper.spStat({ app:stat_app_name, oper: words.join('_'), tar: $(this).find('img').attr('src') });
	});
});
</script>
<script src="http://www.duowan.com/duowan.js" type="text/javascript"></script>
<script src="http://www.duowan.com/public/s/market_count.js" type="text/javascript"></script>
<script src="http://assets.dwstatic.com/wan/E794B5E4BFA1E4B880.js?10" type="text/javascript"></script>
<!--
<div style="display:none;">

	<div id="layer_box">
	
		<img width="200" height="200" src="http://lolbox.duowan.com/doqrcode.php?serverName=%E7%94%B5%E4%BF%A1%E4%B8%80&playerName=%E8%AF%B7%E5%8F%AB%E6%88%91%E4%B8%AD%E8%B7%AF%E6%9D%80%E7%A5%9E" />
	</div>
	
</div>
-->
</body>
</html>


解析:

if(resource.contains("暂无数据"))
		{
			return "暂无数据";
		}
		Parser parser = null;
		NodeList nodeList;
		try
		{
			parser = new Parser(resource);
			parser.setEncoding("UTF-8");
			nodeList = parser.parse(new NodeFilter()
			{
				@Override
				public boolean accept(Node node)
				{
					// 战斗力
					String zdlStr = "";
					if (isContainsZdl(node.getText()))
					{
						zdlStr = replaceBlank(node.toPlainTextString().replace("战斗力", ""));
						ZDL = "战斗力:" + zdlStr + "\n";
					}
					// 场次和胜率
					if (node instanceof TableTag)
					{
						TableTag tag = (TableTag) node;
						TableRow[] rows = tag.getRows();
						for (int j = 0; j < rows.length; j++)
						{
							TableRow tr = (TableRow) rows[j];
							TableColumn[] td = tr.getColumns();
							for (int k = 0; k < td.length; k++)
							{
								if (td.length == 6)
								{
									if (k == 0)
									{
										ZDL = ZDL + replaceBlank(td[k].toPlainTextString()) + ":";
									}
									if (k == 1)
									{
										ZDL = ZDL + "场次=" + replaceBlank(td[k].toPlainTextString()) + " ";
									}
									if (k == 2)
									{
										ZDL = ZDL + "胜率=" + replaceBlank(td[k].toPlainTextString()) + "\n";
									}
								}
							}
						}
					}
					return false;
				}
			});
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		return ZDL;


结果:


其它的 比如分段、最近游戏数据、什么的,都可以在返回的html中解析出来,这里就不多说了。



你可能感兴趣的:(LOL 战斗力查询)