Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김선호
/
troll.gg
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
2
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김선호
2020-11-15 14:13:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f17d8474585dbff038587d4eafb8e86a0b0b5a5d
f17d8474
1 parent
ab90e9ab
2020-11-15 대용량처리테스트
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
8 deletions
Get_Account_Id.py
Get_Game_Id.py
check_score.py
matches.py
Get_Account_Id.py
View file @
f17d847
...
...
@@ -9,12 +9,14 @@ headers={
"Origin"
:
"https://developer.riotgames.com"
,
"X-Riot-Token"
:
APIKEY
}
API
=
"https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/"
+
name
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
LOL_API_DATA
=
getAPI
.
json
()
def
get_account_id
():
API
=
"https://kr.api.riotgames.com/lol/summoner/v4/summoners/by-name/"
+
name
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
LOL_API_DATA
=
getAPI
.
json
()
return
LOL_API_DATA
[
"accountId"
]
def
return_key
():
return
APIKEY
def
return_name
():
return
name
...
...
Get_Game_Id.py
View file @
f17d847
...
...
@@ -16,3 +16,4 @@ def get_game_id(index):
return
LOL_API_DATA
[
index
]
.
get
(
"gameId"
)
def
get_champ_id
(
index
):
return
LOL_API_DATA
[
index
]
.
get
(
"champion"
)
...
...
check_score.py
0 → 100644
View file @
f17d847
import
Get_Account_Id
import
Get_Game_Id
import
requests
APIKEY
=
Get_Account_Id
.
return_key
()
headers
=
{
"User-Agent"
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
,
"Accept-Language"
:
"ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"
,
"Accept-Charset"
:
"application/x-www-form-urlencoded; charset=UTF-8"
,
"Origin"
:
"https://developer.riotgames.com"
,
"X-Riot-Token"
:
APIKEY
}
def
op_score
(
ac_id
):
API
=
"https://kr.api.riotgames.com/lol/match/v4/matchlists/by-account/"
+
ac_id
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
DATA
=
getAPI
.
json
()[
"matches"
]
score
=
0
for
i
in
range
(
0
,
5
):
score
+=
first_step
(
DATA
[
i
]
.
get
(
"gameId"
),
ac_id
)
return
score
def
first_step
(
gameid
,
ac_id
):
API
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
str
(
gameid
)
print
(
gameid
)
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
f_step_api
=
getAPI
.
json
()
t_score
=
0
for
i
in
range
(
0
,
10
):
if
(
f_step_api
[
"participantIdentities"
][
i
][
"player"
][
"accountId"
]
==
ac_id
):
if
f_step_api
[
"participants"
][
i
][
"stats"
][
"deaths"
]
==
0
:
t_score
=
round
((
f_step_api
[
"participants"
][
i
][
"stats"
][
"kills"
]
*
3
+
f_step_api
[
"participants"
][
i
][
"stats"
][
"assists"
]
*
0.5
)
/
\
1
,
2
)
+
round
(
f_step_api
[
"participants"
][
i
][
"stats"
][
"totalMinionsKilled"
]
\
/
(
f_step_api
[
"gameDuration"
]
/
60
)
*
0.2
,
2
)
+
round
(
f_step_api
[
"participants"
][
i
][
"stats"
][
"visionScore"
]
*
0.05
,
2
)
else
:
t_score
=
round
((
f_step_api
[
"participants"
][
i
][
"stats"
][
"kills"
]
*
3
+
f_step_api
[
"participants"
][
i
][
"stats"
][
"assists"
]
*
0.5
)
/
\
(
f_step_api
[
"participants"
][
i
][
"stats"
][
"deaths"
]
*
3
),
2
)
+
round
(
f_step_api
[
"participants"
][
i
][
"stats"
][
"totalMinionsKilled"
]
\
/
(
f_step_api
[
"gameDuration"
]
/
60
)
*
0.2
,
2
)
+
round
(
f_step_api
[
"participants"
][
i
][
"stats"
][
"visionScore"
]
*
0.05
,
2
)
i
=
10
return
t_score
matches.py
View file @
f17d847
import
Get_Account_Id
import
Get_Game_Id
import
check_score
import
requests
APIKEY
=
Get_Account_Id
.
return_key
()
name
=
Get_Account_Id
.
return_name
()
.
replace
(
" "
,
""
)
.
lower
()
headers
=
{
"User-Agent"
:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
,
"Accept-Language"
:
"ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7"
,
...
...
@@ -16,7 +16,6 @@ def game_result(num):
API
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
str
(
gameid
)
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
LOL_API_DATA
=
getAPI
.
json
()
find_user
=-
1
result
=
" "
for
i
in
range
(
0
,
10
):
if
LOL_API_DATA
[
"participants"
][
i
][
"championId"
]
==
champid
:
...
...
@@ -24,8 +23,26 @@ def game_result(num):
result
=
"승리"
else
:
result
=
"패배"
print
(
result
)
return
result
def
match_user_name_and_opscore
(
num
):
gameid
=
Get_Game_Id
.
get_game_id
(
num
)
API
=
"https://kr.api.riotgames.com/lol/match/v4/matches/"
+
str
(
gameid
)
getAPI
=
requests
.
get
(
API
,
headers
=
headers
)
LOL_API_DATA
=
getAPI
.
json
()
record_name
=
[]
record_opscore
=
[]
for
i
in
range
(
0
,
10
):
record_name
.
append
(
LOL_API_DATA
[
"participantIdentities"
][
i
][
"player"
][
"summonerName"
])
print
(
record_name
)
ac_id
=
LOL_API_DATA
[
"participantIdentities"
][
i
][
"player"
][
"accountId"
]
record_opscore
.
append
(
check_score
.
op_score
(
ac_id
))
print
(
record_opscore
)
return
record_name
,
record_opscore
for
j
in
range
(
0
,
10
):
game_result
(
j
)
print
(
game_result
(
j
))
lst1
=
[]
lst2
=
[]
lst1
,
lst2
=
match_user_name_and_opscore
(
j
)
print
(
lst1
)
print
(
lst2
)
...
...
Please
register
or
login
to post a comment