Skip to content

Instantly share code, notes, and snippets.

@Firebladedoge229
Created October 27, 2024 17:28
Show Gist options
  • Save Firebladedoge229/8cf8b7f6f597db6d17efafef82d26207 to your computer and use it in GitHub Desktop.
Save Firebladedoge229/8cf8b7f6f597db6d17efafef82d26207 to your computer and use it in GitHub Desktop.
Quick script I wrote to find your position in ROBLOX's The Haunt avatar contest.
import time
import requests
from colorama import just_fix_windows_console
just_fix_windows_console()
def get_authenticated_user(cookie):
url = "https://users.roblox.com/v1/users/authenticated"
headers = {"Cookie": f".ROBLOSECURITY={cookie}"}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json().get("id")
def check_user_posts(user_id, category, cookie):
url = f"https://apis.roblox.com/posts-api/v1/content-posts/findByUser?userId={user_id}&postTypeFilter={category}"
headers = {"Cookie": f".ROBLOSECURITY={cookie}"}
response = requests.get(url, headers=headers)
response.raise_for_status()
return response.json()
def interpret_placement(placement):
if placement == 4:
return "\033[1;31mNo Votes\033[0m"
elif placement == 3:
return "Bottom \033[1;31m50%\033[0m"
elif placement == 2:
return "Top \033[38;2;52;235;143m50%\033[0m"
elif placement == 1:
return "Top \033[38;2;52;235;143m10%\033[0m"
elif placement == 0:
return "Leaderboard"
else:
return "\033[1;31mUnknown Placement\033[0m"
def main():
cookie = input("\033[38;2;52;235;143mROBLOSECURITY Cookie:\033[0m ").strip()
category = input("\033[38;2;52;235;143mCategory:\033[0m ").strip()
interval = int(input("\033[38;2;52;235;143mInterval:\033[0m ").strip())
try:
user_id = get_authenticated_user(cookie)
print(f"\033[38;2;52;235;143mAuthenticated! \033[0mUser ID:\033[38;2;52;235;143m {user_id}\033[0m")
while True:
posts_data = check_user_posts(user_id, category, cookie)
posts = posts_data.get("posts", [])
if not posts:
print("\033[1;31mNo posts found for the specified category.\033[0m")
else:
for post in posts:
placement = post.get("placement")
placement_status = interpret_placement(placement)
print(f"\033[38;2;52;235;143mPlacement:\033[0m {placement_status}")
if placement == 0 and "top" in post:
print(f"\033[38;2;52;235;143mLeaderboard Rank:\033[0m {post['top']}")
time.sleep(interval)
except requests.HTTPError as e:
print(f"\033[1;31mHTTP Error:\033[0m {e}")
except Exception as e:
print(f"\033[1;31mError:\033[0m {e}")
if __name__ == "__main__":
main()
@Firebladedoge229
Copy link
Author

Javascript version is located here
In order to run this script, you need to install the prerequisites by running:

pip install requests
pip install colorama

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment