-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscrap.py
100 lines (76 loc) · 3.1 KB
/
scrap.py
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
import requests
import os
from time import time, sleep
from rich import print as rprint
from rich.progress import track
discord_id = "304629682769494026"
api_url = "https://api.gtaliferp.fr:8443/v1/extinction/profiles/discord/" + discord_id
headers = {
'authority': 'api.gtaliferp.fr:8443',
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-language': 'fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7',
'cache-control': 'max-age=0',
'if-none-match': 'W/"924-RsfQlc+eIHVpM+alWwa0sGX4uP8"',
'sec-ch-ua': '"Google Chrome";v="107", "Chromium";v="107", "Not=A?Brand";v="24"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'document',
'sec-fetch-mode': 'navigate',
'sec-fetch-site': 'none',
'sec-fetch-user': '?1',
'upgrade-insecure-requests': '1',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36',
}
stats_dict = {
"zombie": 12,
"kill":9,
"death":11,
"ratio":29,
"zombie_redzone":6,
"kill_redzone":4,
"death_redzone":8,
"ratio_redzone":30,
"played_time":1
}
def time_conversion(playtime): ## askpython.com
sec_value = playtime % (24 * 3600)
hour_value = sec_value // 3600
sec_value %= 3600
minutes = sec_value // 60
sec_value %= 60
if minutes < 10:
time = f"{hour_value}:0{minutes}"
else:
time = f"{hour_value}:{minutes}"
rprint(f"[cyan]{time : <10}[purple] 🕒 Temps de jeu")
def main():
response = requests.get(api_url, headers=headers)
data = response.json()
hour_value = 0
minutes = 0
zombie_kills = data["stats"][stats_dict["zombie"]]["value"]
pvp_kills = data["stats"][stats_dict["kill"]]["value"]
deaths = data["stats"][stats_dict["death"]]["value"]
ratio = data["stats"][stats_dict["ratio"]]["value"]
zombie_redzone = data["stats"][stats_dict["zombie_redzone"]]["value"]
kills_redzone = data["stats"][stats_dict["kill_redzone"]]["value"]
deaths_redzone = data["stats"][stats_dict["death_redzone"]]["value"]
ratio_redzone = data["stats"][stats_dict["ratio_redzone"]]["value"]
playtime = data["stats"][stats_dict["played_time"]]["value"]
level = data["rank"]
rprint(f"{zombie_kills : <10}[purple] 🧟 Zombies tués")
rprint(f"{pvp_kills : <10}[purple] ⚔️ Opps tués")
rprint(f"{deaths : <10}[purple] 🩸 Morts")
rprint(f"{ratio : <10}[purple] 〽 Ratio")
rprint(f"{zombie_redzone : <10}[purple] 🧟🔴 Zombies tués en redzone")
rprint(f"{kills_redzone : <10}[purple] ⚔️🔴 Opps tués en redzone")
rprint(f"{deaths_redzone : <10}[purple] 🩸🔴 Morts en redzone")
rprint(f"{ratio_redzone : <10}[purple] 〽🔴 Ratio en redzone")
rprint(f"{level : <10}[purple] 👾 Niveau")
time_conversion(playtime)
while True:
os.system('cls||clear') # Clears terminal for readability.
main()
rprint("")
for _ in track(range(100), description="[purple]Délai API"):
sleep(0.6)