-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
367 lines (347 loc) · 14.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CS2 Stats Fetch</title>
<link href="https://fonts.googleapis.com/icon?family=Fira+Mono" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="styles.css">
<script>
var url = "https://api.wmpvp.com/api/csgo/home/official/detailStats";
var invUrl = '';
var steamId;
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('fetchStats').addEventListener('click', function() {
//getId();
steamId=document.getElementById('steamIdInput').value;
csgoSeasonId=document.getElementById('csgoSeasonId').value;
waitForId();
});
});
function encodeFormData(data) {
return Object.keys(data)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
.join('&');
}
function getId() {
steamId ='';
steamLink = document.getElementById('steamIdInput').value;
console.log(steamLink);
const targetUrl = 'https://corsproxy.io/?' + encodeURIComponent('https://www.csgola.com/player');
//yes,csgola.com
const payload = {
'playerid': steamLink
};
const headers = {
'User-Agent': "okhttp/4.11.0",
'Host': "cs.tkm.icu",
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
};
fetch(targetUrl, {
method: 'POST',
headers: headers,
body: encodeFormData(payload)
})
.then(response => response.json())
.then(data => {
steamId = data.msg;
console.log(data);
})
.catch(error => {
console.error('Error:', error);
});
}
function getStats(){
const payload = {
"toSteamId": steamId,
"mySteamId": steamId,
"accessToken": ""// In principle, a valid accessToken should be filled in here, but actually even leaving it blank will not affect the return value (obtain by listening perfectworld app
};
const headers = {
'User-Agent': "okhttp/4.11.0",
'Content-Type': "application/json",
'gameType': "1,2",
'gameTypeStr': "1,2",
't': Math.floor(Date.now() / 1000)
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => {
// 更新头像和昵称
const avatarPW = data.data.avatar || 'https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg';
const avatar = avatarPW.replace('cdn.wmpvp.com/avatars', 'avatars.akamai.steamstatic.com').replace('.jpg', '_full.jpg');
document.getElementById('avatar').src = avatar;
document.getElementById('nickName').textContent = data.data.nickName;
// 更新统计数据
document.getElementById('hours').textContent = data.data.hours || 'N/A';
document.getElementById('friendCode').textContent = data.data.friendCode || 'N/A';
document.getElementById('recentRating').textContent = (data.data.historyRatings && data.data.historyRatings.length > 0) ? (data.data.historyRatings.reduce((acc, val) => acc + val, 0) / data.data.historyRatings.length).toFixed(2) : 'N/A';
document.getElementById('winRate').textContent = data.data.winRate || 'N/A';
document.getElementById('kd').textContent = data.data.kd || 'N/A';
document.getElementById('adr').textContent = data.data.adr || 'N/A';
document.getElementById('rating').textContent = data.data.rating || 'N/A';
document.getElementById('kast').textContent = data.data.kast + '\%' || 'N/A';
document.getElementById('rws').textContent = data.data.rws || 'N/A';
document.getElementById('headShotRatio').textContent = data.data.headShotRatio || 'N/A';
document.getElementById('entryKillRatio').textContent = data.data.entryKillRatio || 'N/A';
document.getElementById('awpKillRatio').textContent = data.data.awpKillRatio || 'N/A';
document.getElementById('flashSuccessRatio').textContent = data.data.flashSuccessRatio || 'N/A';
})
.catch(error => {
console.error('Error:', error);
// 如果请求失败,设置默认头像
document.getElementById('avatar').src = 'https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg';
});
}
function getWmpvpStats() {
const wmpvpUrl = 'https://api.wmpvp.com/api/v2/csgo/pvpDetailDataStats';
const payload = {
"steamId64": steamId, // 替换为实际需要的steamId64
"csgoSeasonId": csgoSeasonId // 替换为实际的赛季ID
};
const headers = {
'User-Agent': "okhttp/4.11.0",
'Content-Type': "application/json",
't': Math.floor(Date.now() / 1000)
};
fetch(wmpvpUrl, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => {
// 检查数据有效性
if (data && data.data) {
// 更新统计数据
document.getElementById('wmpvpName').textContent = data.data.name || 'N/A';
document.getElementById('wmpvpWinRate').textContent = data.data.winRate || 'N/A';
document.getElementById('wmpvpKd').textContent = data.data.kd || 'N/A';
document.getElementById('wmpvpAdr').textContent = data.data.adr || 'N/A';
document.getElementById('wmpvpRating').textContent = data.data.rating || 'N/A';
document.getElementById('wmpvpRws').textContent = data.data.rws || 'N/A';
document.getElementById('wmpvpHeadShotRatio').textContent = data.data.headShotRatio || 'N/A';
document.getElementById('wmpvpEntryKillRatio').textContent = data.data.entryKillRatio || 'N/A';
} else {
console.error('Invalid data structure:', data);
}
})
.catch(error => {
console.error('Error:', error);
// 如果请求失败,设置默认头像
document.getElementById('avatar').src = 'https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg';
});
}
function getPwa() {
fetch(pwaUrl, {
method: 'GET'
})
.then(response => response.json())
.then(data => {
document.getElementById('pwaId').textContent = 'PerfectWorld Arena ID: ' + data.result.userId || '';
})
.catch(error => {
console.error('Error:', error);
});
}
function getInv() {
document.getElementById('inv').innerHTML = `<div class="stat-item">
<span class="stat-title" style="font-size: 13px;">Inventory Prize:</span>
<span id="invPrize" class="stat-value" style="font-size: 15px;"></span>
</div>`;
fetch(invUrl, {
method: 'GET'
})
.then(response => response.json())
.then(data => {
// 更新总价
document.getElementById('invPrize').textContent = (data.result.totalPrice / 100) + ' CNY' || 'N/A';
const invContainer = document.getElementById('inv');
data.result.previewItem.forEach(item => {
const itemDiv = document.createElement('div');
itemDiv.className = 'stat-item';
itemDiv.innerHTML = `<span class="stat-title" style="font-size: 10px; max-height: 8px;">${item.marketHashName}</span>
<span class="stat-value" style="font-size: 12px; max-height: 8px;">${(item.steamPrice/100) +'CNY' || 'N/A'}</span>`;
invContainer.appendChild(itemDiv);
});
})
.catch(error => {
console.error('Error:', error);
});
}
function waitForId() {
if(steamId) {
invUrl = 'https://gwapi.pwesports.cn/appdecoration/steamcn/csgo/decoration/getSteamInventoryPreview?steamId=' + steamId + '&previewSize=20';
pwaUrl = 'https://appengine.wmpvp.com/steamcn/app/common/getUserIdBySteamId?steamId=' + steamId;
getStats ();
getWmpvpStats ();
getInv ();
getPwa ();
} else {
setTimeout(waitForId, 100);
}
}
</script>
</head>
<body>
<div class="container">
<!-- 输入框 -->
<div class="input-group">
<label for="steamIdInput">steamid64:</label>
<input type="text" id="steamIdInput" class="steam-id-input"/>
</div>
<!-- 选择框 -->
<div class="select-group">
<label for="csgoSeasonId">Season:</label>
<select id="csgoSeasonId">
<option value="S1">S1</option>
<option value="S2">S2</option>
<option value="S3">S3</option>
<option value="S4">S4</option>
<option value="S5">S5</option>
<option value="S6">S6</option>
<option value="S7">S7</option>
<option value="S8">S8</option>
<option value="S9">S9</option>
<option value="S10">S10</option>
<option value="S11">S11</option>
<option value="S12">S12</option>
<option value="S13">S13</option>
<option value="S14">S14</option>
<option value="S15">S15</option>
<option value="S16">S16</option>
<option value="S17">S17</option>
<option value="S18">S18</option>
</select>
</div>
<!-- 玩家信息 -->
<div class="profile-header">
<img id="avatar" src="https://avatars.akamai.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg" alt="Avatar" class="avatar"/>
<div class="player-info">
<span id="nickName" class="nickname"></span>
<span id="friendCode" class="friend-code"></span>
<span id="pwaId" class="pwa-id"></span>
</div>
</div>
<!-- 统计数据 -->
<div style="display: flex;">
<div class="stats">
<div class="stat-item">
<span class="stat-title">Hours:</span>
<span id="hours" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Recent Rating:</span>
<span id="recentRating" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Win Rate:</span>
<span id="winRate" class="stat-value"></span>
</div>
<!-- 其他统计数据 -->
<div class="stat-item">
<span class="stat-title">K/D:</span>
<span id="kd" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">ADR:</span>
<span id="adr" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Rating:</span>
<span id="rating" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">KAST:</span>
<span id="kast" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">RWS:</span>
<span id="rws" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">HS Ratio:</span>
<span id="headShotRatio" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Entry Kill Ratio:</span>
<span id="entryKillRatio" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">AWP Kill Ratio:</span>
<span id="awpKillRatio" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Flash Success Ratio:</span>
<span id="flashSuccessRatio" class="stat-value"></span>
</div>
</div>
<!-- 新增的 WMPVP 统计数据列 -->
<div class="stats">
<div class="stat-item">
<span class="stat-title">Wmpvp Name:</span>
<span id="wmpvpName" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp Win Rate:</span>
<span id="wmpvpWinRate" class="stat-value"></span>
</div>
<!-- 其他统计数据 -->
<div class="stat-item">
<span class="stat-title">Wmpvp K/D:</span>
<span id="wmpvpKd" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp ADR:</span>
<span id="wmpvpAdr" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp Rating:</span>
<span id="wmpvpRating" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp RWS:</span>
<span id="wmpvpRws" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp HS Ratio:</span>
<span id="wmpvpHeadShotRatio" class="stat-value"></span>
</div>
<div class="stat-item">
<span class="stat-title">Wmpvp Entry Kill Ratio:</span>
<span id="wmpvpEntryKillRatio" class="stat-value"></span>
</div>
</div>
<div id = "inv" class="stats">
<div class="stat-item">
<div id="FreePalestine">
<img src="https://s2.loli.net/2024/04/01/ZdHISCYlWG9xUai.png" width="256" height="171">
<span class="stat-title" style="font-size: 24px;"><br>The Israeli occupation of Palestine has caused thousands of children to suffer every day.<br> Consider helping them: <br>
<a href="https://www.pcrf.net/" target="_blank">PCRF</a> -
<a href="https://help.unicef.org/donate-to-children" target="_blank">UNICEF</a> -
<a href="https://donate.unrwa.org/gaza/~my-donation" target="_blank">UNRWA</a>
</span>
</div>
<span id="invPrize" class="stat-value" style="font-size: 15px;"></span>
</div>
</div>
</div>
<!-- 按钮 -->
<div style="display: flex;">
<button id="fetchStats" class="fetch-stats">POST</button>
<div id="copyright">
<script>
function Year(number) { return (number < 1000) ? number + 1900 : number; }
document.write('© '+Year(new Date().getYear())+' 渟雲 - All Rights Reserved');
</script>
<a href="https://www.hvhbbs.com">
<img src="https://github.com/M3351AN/CS2-Stats-Fetch/assets/65479796/a40d9ed5-d4fc-4401-a159-17e37f33cb9c">
</a>
</div>
</div>
</div>
</body>
</html>