import requests
import time
# List of user IDs
user_ids = [
# Function to check online status in batches
def check_online_status_batch(batch):
url = "https://presence.roproxy.com/v1/presence/"
params = {"userIds": ",".join(map(str, batch))}
response = requests.get(url, params=params)
if response.status_code == 200:
return response.json()
else:
print(f"Error fetching batch: {response.status_code}")
return {}
# Function to process results
def process_results(results):
online_users = []
in_game_users = []
for user_id, presence_data in results.items():
user_presence_type = presence_data.get("userPresenceType")
if user_presence_type == 1:
online_users.append(user_id)
elif user_presence_type == 2:
in_game_users.append(user_id)
return online_users, in_game_users
# Main script
batch_size = 15
delay = 10 # seconds
all_online_users = []
all_in_game_users = []
for i in range(0, len(user_ids), batch_size):
batch = user_ids[i:i + batch_size]
print(f"Checking batch: {batch}")
results = check_online_status_batch(batch)
online_users, in_game_users = process_results(results)
all_online_users.extend(online_users)
all_in_game_users.extend(in_game_users)
print(f"Online Users: {online_users}")
print(f"In-Game Users: {in_game_users}")
if i + batch_size < len(user_ids): # Add delay unless it's the last batch
print(f"Waiting {delay} seconds before next batch...")
time.sleep(delay)
print("\nFinal Results:")
print(f"All Online Users: {all_online_users}")
print(f"All In-Game Users: {all_in_game_users}")