Showing
1 changed file
with
8 additions
and
6 deletions
... | @@ -98,7 +98,7 @@ res.render('example.ejs',{data:test}); | ... | @@ -98,7 +98,7 @@ res.render('example.ejs',{data:test}); |
98 | //console.log(`${profileID}`);//테스트용 : profileID 출력 | 98 | //console.log(`${profileID}`);//테스트용 : profileID 출력 |
99 | 99 | ||
100 | var match_history_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/"//매치히스토리 url 앞부분 | 100 | var match_history_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/"//매치히스토리 url 앞부분 |
101 | - var match_history_2="/matches?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi"//매치히스토리 url 뒷부분 | 101 | + var match_history_2="/matches?access_token=US115TlhyMaYe3d3v4t6j17Umw1CfsvCIV"//매치히스토리 url 뒷부분 |
102 | var match_history_url=match_history_1+profileID+match_history_2;//매치히스토리 url 구성 | 102 | var match_history_url=match_history_1+profileID+match_history_2;//매치히스토리 url 구성 |
103 | console.log(match_history_url);//테스트용 : 매치히스토리 url 출력 | 103 | console.log(match_history_url);//테스트용 : 매치히스토리 url 출력 |
104 | 104 | ||
... | @@ -106,7 +106,7 @@ res.render('example.ejs',{data:test}); | ... | @@ -106,7 +106,7 @@ res.render('example.ejs',{data:test}); |
106 | if(error){throw error};//에러처리 | 106 | if(error){throw error};//에러처리 |
107 | console.log('request3 processing');//테스트용 : request 작동여부 출력 | 107 | console.log('request3 processing');//테스트용 : request 작동여부 출력 |
108 | 108 | ||
109 | - var obj1=JSON.parse(body);//request 결과를 JSON object로 변환 | 109 | + var obj1=JSON.parse(body);//request 결과를 JSON objerct로 변환 |
110 | //console.log(obj.matches [0].map);//테스트용 : 하나에 접근 | 110 | //console.log(obj.matches [0].map);//테스트용 : 하나에 접근 |
111 | $(obj1.matches).each(function(index,match){//body에서 각각의 배열요소 match들과 인덱스 사용 | 111 | $(obj1.matches).each(function(index,match){//body에서 각각의 배열요소 match들과 인덱스 사용 |
112 | if(match.type=='1v1'){//경기타입이 1대1인 경우에만 관심있다. | 112 | if(match.type=='1v1'){//경기타입이 1대1인 경우에만 관심있다. |
... | @@ -115,28 +115,30 @@ res.render('example.ejs',{data:test}); | ... | @@ -115,28 +115,30 @@ res.render('example.ejs',{data:test}); |
115 | });//each function 종료 | 115 | });//each function 종료 |
116 | 116 | ||
117 | var ladder_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/" | 117 | var ladder_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/" |
118 | - var ladder_2="/ladders?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi"; | 118 | + var ladder_2="/ladders?access_token=US115TlhyMaYe3d3v4t6j17Umw1CfsvCIV"; |
119 | var ladder_url=ladder_1+profileID+ladder_2; | 119 | var ladder_url=ladder_1+profileID+ladder_2; |
120 | console.log(ladder_url); | 120 | console.log(ladder_url); |
121 | request(ladder_url,(error,response,body)=>{//ladder request request 4 | 121 | request(ladder_url,(error,response,body)=>{//ladder request request 4 |
122 | if(error){throw error}; | 122 | if(error){throw error}; |
123 | console.log('request4 processing'); | 123 | console.log('request4 processing'); |
124 | var obj2=JSON.parse(body);//request 결과를 JSON object로 변환 | 124 | var obj2=JSON.parse(body);//request 결과를 JSON object로 변환 |
125 | + //console.log(body); | ||
125 | // console.log(obj2.currentSeason [2].ladder[0].wins);//테스트용 : 하나에 접근 | 126 | // console.log(obj2.currentSeason [2].ladder[0].wins);//테스트용 : 하나에 접근 |
126 | - var wins=obj2.currentSeason[2].ladder[0].wins; | 127 | + var wins=obj2.currentSeason[3].ladder[0].wins; |
127 | - var losses=obj2.currentSeason[2].ladder[0].losses; | 128 | + var losses=obj2.currentSeason[3].ladder[0].losses; |
128 | win_rate=wins/(wins+losses); | 129 | win_rate=wins/(wins+losses); |
129 | //console.log(wins); | 130 | //console.log(wins); |
130 | //console.log(losses); | 131 | //console.log(losses); |
131 | //console.log(win_rate); | 132 | //console.log(win_rate); |
132 | 133 | ||
133 | var profile_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/"; | 134 | var profile_1="https://kr.api.blizzard.com/sc2/legacy/profile/3/1/"; |
134 | - var profile_2="?access_token=US0q3wV6W1fIYZmRnEBbNvUrRHYZhwANIi"; | 135 | + var profile_2="?access_token=US115TlhyMaYe3d3v4t6j17Umw1CfsvCIV"; |
135 | var profile_url=profile_1+profileID+profile_2; | 136 | var profile_url=profile_1+profileID+profile_2; |
136 | console.log(profile_url); | 137 | console.log(profile_url); |
137 | request(profile_url,(error,response,body)=>{//profile request request 5 | 138 | request(profile_url,(error,response,body)=>{//profile request request 5 |
138 | if(error){throw error}; | 139 | if(error){throw error}; |
139 | console.log('request5 processing'); | 140 | console.log('request5 processing'); |
141 | + //console.log(body); | ||
140 | var obj3=JSON.parse(body);//request 결과를 JSON object로 변환 | 142 | var obj3=JSON.parse(body);//request 결과를 JSON object로 변환 |
141 | //console.log(obj2.currentSeason [1].ladder[0].wins);//테스트용 : 하나에 접근 | 143 | //console.log(obj2.currentSeason [1].ladder[0].wins);//테스트용 : 하나에 접근 |
142 | primary_race=obj3.career.primaryRace; | 144 | primary_race=obj3.career.primaryRace; | ... | ... |
-
Please register or login to post a comment