forked from xpowner99090/FreeFire-UID-API-by-XPOPU
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
78 lines (64 loc) · 2.82 KB
/
Copy pathapp.py
File metadata and controls
78 lines (64 loc) · 2.82 KB
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
from flask import Flask, request, jsonify
import requests
from rich.console import Console
from rich.progress import Progress
app = Flask(__name__)
console = Console()
def check_player_info(target_id):
with Progress() as progress:
task = progress.add_task("[cyan]Fetching player data...", total=100)
cookies = {
'_ga': 'GA1.1.2123120599.1674510784',
'_fbp': 'fb.1.1674510785537.363500115',
'_ga_7JZFJ14B0B': 'GS1.1.1674510784.1.1.1674510789.0.0.0',
'source': 'mb',
'region': 'MA',
'language': 'ar',
'_ga_TVZ1LG7BEB': 'GS1.1.1674930050.3.1.1674930171.0.0.0',
'datadome': '6h5F5cx_GpbuNtAkftMpDjsbLcL3op_5W5Z-npxeT_qcEe_7pvil2EuJ6l~JlYDxEALeyvKTz3~LyC1opQgdP~7~UDJ0jYcP5p20IQlT3aBEIKDYLH~cqdfXnnR6FAL0',
'session_key': 'efwfzwesi9ui8drux4pmqix4cosane0y',
}
headers = {
'Accept-Language': 'en-US,en;q=0.9',
'Connection': 'keep-alive',
'Origin': 'https://shop2game.com',
'Referer': 'https://shop2game.com/app/100067/idlogin',
'User-Agent': 'Mozilla/5.0 (Linux; Android 11; Redmi Note 8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Mobile Safari/537.36',
'accept': 'application/json',
'content-type': 'application/json',
'sec-ch-ua': '"Chromium";v="107", "Not=A?Brand";v="24"',
'sec-ch-ua-mobile': '?1',
'sec-ch-ua-platform': '"Android"',
'x-datadome-clientid': '6h5F5cx_GpbuNtAkftMpDjsbLcL3op_5W5Z-npxeT_qcEe_7pvil2EuJ6l~JlYDxEALeyvKTz3~LyC1opQgdP~7~UDJ0jYcP5p20IQlT3aBEIKDYLH~cqdfXnnR6FAL0',
}
json_data = {
'app_id': 100067,
'login_id': target_id,
'app_server_id': 0,
}
try:
progress.update(task, advance=30)
res = requests.post('https://shop2game.com/api/auth/player_id_login',
cookies=cookies, headers=headers, json=json_data)
if res.status_code != 200 or not res.json().get('nickname'):
return {"error": "ID NOT FOUND"}
player_data = res.json()
nickname = player_data.get('nickname', 'N/A')
progress.update(task, advance=70)
return {
"nickname": nickname
}
except requests.exceptions.RequestException as e:
return {"error": str(e)}
# ✅ Custom Route: /xp-opu
@app.route('/xp-opu', methods=['GET'])
def get_region_info():
uid = request.args.get('uid')
if not uid:
return jsonify({"error": "UID parameter is required"}), 400
result = check_player_info(uid)
if "error" in result:
return jsonify(result), 404
return jsonify(result)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)