Original Link: https://rentry.co/roblox_vm_game_recommendations/
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | import requests
import time
import json
import os
import re
def clean_filename(name):
return re.sub(r'[\*"/\\<>:|?]', '', name).strip()
def get_universe_id(place_id):
url = f"https://apis.roblox.com/universes/v1/places/{place_id}/universe"
while True:
response = requests.get(url)
if response.status_code == 200:
data = response.json()
universe_id = data.get("universeId")
if universe_id is not None:
return universe_id
else:
print("Error")
time.sleep(5)
def get_place_name(universe_id):
url = f"https://games.roblox.com/v1/games?universeIds={universe_id}"
while True:
response = requests.get(url)
if response.status_code == 200:
data = response.json()
game_list = data.get("data")
if game_list:
game = game_list[0]
return game.get("name")
else:
print("Error")
time.sleep(5)
def get_gamepasses(universe_id):
url = f"https://games.roblox.com/v1/games/{universe_id}/game-passes?limit=100&sortOrder=Asc"
while True:
response = requests.get(url)
if response.status_code == 200:
data = response.json()
gamepasses_list = data.get("data")
# store list
gamepasses = []
if gamepasses_list:
# the great filter
for gamepass in gamepasses_list:
price = gamepass.get("price")
# check if price isn't null
if price is not None:
gamepasses_info = {
"id": gamepass.get("id"),
"name": gamepass.get("name"),
"price": gamepass.get("price")
}
gamepasses.append(gamepasses_info)
return gamepasses
def get_developer_products(universe_id):
url = f"https://apis.roblox.com/developer-products/v2/universes/{universe_id}/developerproducts?limit=100"
while True:
response = requests.get(url)
if response.status_code == 200:
data = response.json()
products_list = data.get("developerProducts")
# store list
products = []
if products_list:
# the great filter
for product in products_list:
product_info = {
"ProductId": product.get("ProductId"),
"DisplayName": product.get("displayName"),
"IsForSale": product.get("IsForSale"),
"PriceInRobux": product.get("PriceInRobux"),
"Created": product.get("Created"),
"Updated": product.get("Updated")
}
products.append(product_info)
return products
else:
print("Error")
time.sleep(5)
while True:
place_id = input("Insert ROBLOX place ID: ")
universe_id = get_universe_id(place_id)
print("Universe ID: " + str(universe_id))
game_name = get_place_name(universe_id)
folder_name = f"{clean_filename(game_name)} [{place_id}]"
os.makedirs(folder_name, exist_ok=True)
gamepasses_list = get_gamepasses(universe_id)
with open(os.path.join(folder_name, "gamepasses.txt"), "w", encoding="utf-8") as f:
f.write(json.dumps(gamepasses_list, indent=4))
products_list = get_developer_products(universe_id)
with open(os.path.join(folder_name, "products.txt"), "w", encoding="utf-8") as f:
f.write(json.dumps(products_list, indent=4))
print("Saved gamepasses and developer products info.")
|