Showing
2 changed files
with
56 additions
and
6 deletions
| ... | @@ -89,7 +89,7 @@ request(rtfw1,(error,response,body)=>{//rtfw url 불러오기 | ... | @@ -89,7 +89,7 @@ request(rtfw1,(error,response,body)=>{//rtfw url 불러오기 |
| 89 | profileID=profileID.slice(0,localindex4);//뒷부분 슬래시 자른다. | 89 | profileID=profileID.slice(0,localindex4);//뒷부분 슬래시 자른다. |
| 90 | console.log(`${profileID}`);//테스트용 : profileID 출력 | 90 | console.log(`${profileID}`);//테스트용 : profileID 출력 |
| 91 | });//a bnetlink 종료 | 91 | });//a bnetlink 종료 |
| 92 | -console.log(`${profileID}`);//테스트용 : profileID 출력 | 92 | +//console.log(`${profileID}`);//테스트용 : profileID 출력 |
| 93 | 93 | ||
| 94 | var match_history_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/" | 94 | var match_history_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/" |
| 95 | var match_history_2="/matches?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi" | 95 | var match_history_2="/matches?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi" |
| ... | @@ -97,7 +97,7 @@ var match_history_url=match_history_1+profileID+match_history_2; | ... | @@ -97,7 +97,7 @@ var match_history_url=match_history_1+profileID+match_history_2; |
| 97 | console.log(match_history_url); | 97 | console.log(match_history_url); |
| 98 | request(match_history_url,(error,response,body)=>{ | 98 | request(match_history_url,(error,response,body)=>{ |
| 99 | if(error){throw error}; | 99 | if(error){throw error}; |
| 100 | - console.log('request3 processing'); | 100 | + console.log('request3-1 processing'); |
| 101 | //console.log(body); //테스트용: response body 출력 | 101 | //console.log(body); //테스트용: response body 출력 |
| 102 | //JsonParser jsonParser=new JsonParser(); | 102 | //JsonParser jsonParser=new JsonParser(); |
| 103 | //JsonObject jsonObject=(JsonObject) jsonParser.parse(json); | 103 | //JsonObject jsonObject=(JsonObject) jsonParser.parse(json); |
| ... | @@ -111,10 +111,9 @@ request(match_history_url,(error,response,body)=>{ | ... | @@ -111,10 +111,9 @@ request(match_history_url,(error,response,body)=>{ |
| 111 | // System.out.println(matches.decision); | 111 | // System.out.println(matches.decision); |
| 112 | //} | 112 | //} |
| 113 | 113 | ||
| 114 | -var obj=JSON.parse(body);//request 결과를 JSON object로 변환 | 114 | +var obj1=JSON.parse(body);//request 결과를 JSON object로 변환 |
| 115 | -// console.log(obj); | ||
| 116 | //console.log(obj.matches [0].map);//테스트용 : 하나에 접근 | 115 | //console.log(obj.matches [0].map);//테스트용 : 하나에 접근 |
| 117 | -$(obj.matches).each(function(index,match){//body에서 각각의 배열요소 match들과 인덱스 사용 | 116 | +$(obj1.matches).each(function(index,match){//body에서 각각의 배열요소 match들과 인덱스 사용 |
| 118 | if(match.type=='1v1'){//경기타입이 1대1인 경우에만 관심있다. | 117 | if(match.type=='1v1'){//경기타입이 1대1인 경우에만 관심있다. |
| 119 | console.log(index+":::",match.decision,match.map);//인덱스와 승패, 맵 표시 | 118 | console.log(index+":::",match.decision,match.map);//인덱스와 승패, 맵 표시 |
| 120 | };//if 1v1 종료 | 119 | };//if 1v1 종료 |
| ... | @@ -122,8 +121,43 @@ $(obj.matches).each(function(index,match){//body에서 각각의 배열요소 ma | ... | @@ -122,8 +121,43 @@ $(obj.matches).each(function(index,match){//body에서 각각의 배열요소 ma |
| 122 | //var jsonstring=JSON.stringify(body);//json형식의 string으로 변환 | 121 | //var jsonstring=JSON.stringify(body);//json형식의 string으로 변환 |
| 123 | //console.log(jsonstring);//테스트용 : jsontext에 바디가 적절히 들어가는지 검사 | 122 | //console.log(jsonstring);//테스트용 : jsontext에 바디가 적절히 들어가는지 검사 |
| 124 | 123 | ||
| 124 | +});//request3-1종료 | ||
| 125 | +var ladder_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/" | ||
| 126 | +var ladder_2="/ladders?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi"; | ||
| 127 | +var ladder_url=ladder_1+profileID+ladder_2; | ||
| 128 | +console.log(ladder_url); | ||
| 129 | +request(ladder_url,(error,response,body)=>{ | ||
| 130 | + if(error){throw error}; | ||
| 131 | + console.log('request3-2 processing'); | ||
| 132 | + var obj2=JSON.parse(body);//request 결과를 JSON object로 변환 | ||
| 133 | + //console.log(obj2.currentSeason [1].ladder[0].wins);//테스트용 : 하나에 접근 | ||
| 134 | + var wins=obj2.currentSeason[1].ladder[0].wins; | ||
| 135 | + var losses=obj2.currentSeason[1].ladder[0].losses; | ||
| 136 | + var winrate=wins/(wins+losses); | ||
| 137 | + console.log(wins); | ||
| 138 | + console.log(losses); | ||
| 139 | + console.log(winrate); | ||
| 140 | +});//request3-2종료 | ||
| 141 | + | ||
| 142 | +var profile_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/"; | ||
| 143 | +var profile_2="?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi"; | ||
| 144 | +var profile_url=profile_1+profileID+profile_2; | ||
| 145 | +console.log(profile_url); | ||
| 146 | +request(profile_url,(error,response,body)=>{ | ||
| 147 | + if(error){throw error}; | ||
| 148 | + console.log('request3-3 processing'); | ||
| 149 | + var obj3=JSON.parse(body);//request 결과를 JSON object로 변환 | ||
| 150 | + //console.log(obj2.currentSeason [1].ladder[0].wins);//테스트용 : 하나에 접근 | ||
| 151 | + var primary_race=obj3.career.primaryRace; | ||
| 152 | + console.log(primary_race); | ||
| 153 | + var terran_level=obj3.swarmLevels.terran.level; | ||
| 154 | + var zerg_level=obj3.swarmLevels.zerg.level; | ||
| 155 | + var protoss_level=obj3.swarmLevels.protoss.level; | ||
| 156 | + console.log(terran_level); | ||
| 157 | + console.log(zerg_level); | ||
| 158 | + console.log(protoss_level); | ||
| 159 | +});//request3-3종료 | ||
| 125 | 160 | ||
| 126 | -});//request3종료 | ||
| 127 | });//request2종료 | 161 | });//request2종료 |
| 128 | // }catch(error){ | 162 | // }catch(error){ |
| 129 | // console.error(error); | 163 | // console.error(error); | ... | ... |
| ... | @@ -9,3 +9,19 @@ | ... | @@ -9,3 +9,19 @@ |
| 9 | 없애야 할 철자 : y e r / " 5가지 | 9 | 없애야 할 철자 : y e r / " 5가지 |
| 10 | 추가구현사항 : 전체페이지검색, 한글검색 | 10 | 추가구현사항 : 전체페이지검색, 한글검색 |
| 11 | 중요포인트 : 편법도 아니고 15초안에 제공가능하다는점! | 11 | 중요포인트 : 편법도 아니고 15초안에 제공가능하다는점! |
| 12 | +주종족 추가됨. url에 region realm | ||
| 13 | +최근 5경기 결과로 상승세를 추정 | ||
| 14 | +최근 25경기 결과로 승률 50퍼가 넘는 맵 추정 | ||
| 15 | +종족레벨 50이 안되면 해당 종족 비숙련자 | ||
| 16 | +그냥 정보:이번시즌 전체승률, 주종족 | ||
| 17 | +파기정보 : 종족별 승수 | ||
| 18 | + | ||
| 19 | +< API를 통해 가져올 수 있는 데이터 > | ||
| 20 | + | ||
| 21 | +1. 최근 이겼는지 졌는지 | ||
| 22 | +2. 맵 | ||
| 23 | +3. 종족 레벨 | ||
| 24 | +4. 이번 시즌 전체 승률 | ||
| 25 | +5. 종족별 승수 | ||
| 26 | + | ||
| 27 | +6. 주 종족 | ... | ... |
-
Please register or login to post a comment