repl.it
@AzureScripts/

RBLXStats

Python

No description

fork
loading
Files
  • main.py
  • Packager files
  • poetry.lock
  • pyproject.toml
  • requirements.txt
main.py
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
import requests, os, time, argparse
import lxml
from colorama import *
from bs4 import BeautifulSoup

id = input("id: ")

time.sleep(2)

game = f"https://www.roblox.com/games/{id}/"
r  = requests.get(game)
data = r.text
soup = BeautifulSoup(data, features="lxml")
stats = soup.findAll('li', attrs={'class' : 'game-stat'})

# FINDING STATS

# FIND NAME
game_title_container = soup.find("div", attrs={'class' : "game-title-container"})
game_title = game_title_container.find('h2', attrs={'class' : 'game-name'}).text

# FIND CREATOR
creator_container = game_title_container.find('div', attrs={'class' : 'game-creator'})
creator_name = creator_container.find('a', attrs={'class' : 'text-name'}).text
creator_link = creator_container.find('a', attrs={'class' : 'text-name'})['href']

# FIND CURRENT PLAYERS
current_players = stats[0]
player_count = current_players.find("p", attrs={'class': 'text-lead font-caption-body wait-for-i18n-format-render'}).text

# FIND FAVOURITES
favourites = stats[1]
favourite_count = favourites.find('p', attrs={'class' : 'text-lead font-caption-body wait-for-i18n-format-render'}).text

# FIND VISITS

visits = stats[2]
visit_count = visits.find('p', attrs={"id" : "game-visit-count"})['title']

# FIND CREATED

created = stats[3]
created_date = created.find('p', attrs={"class" : "text-lead font-caption-body"}).text

# FIND LAST UPDATED
updated = stats[4]
updated_date = updated.find('p', attrs={"class" : "text-lead font-caption-body"}).text

print("")
print(Fore.GREEN + "===== GAME INFORMATION =====" + Fore.RESET)
print(Fore.RED + "Name: " + Fore.RESET + game_title.encode('ascii', 'ignore').decode('ascii'))
time.sleep(0.5)
print(Fore.RED + "Creator: " + Fore.RESET + creator_name + Fore.BLUE + " (" + creator_link + ")" + Fore.RESET)
time.sleep(0.5)
print(Fore.RED + "Current Players: " + Fore.RESET + player_count)
time.sleep(0.5)
print(Fore.RED + "Favourites: " + Fore.RESET + favourite_count)
time.sleep(0.5)
print(Fore.RED + "Visits: " + Fore.RESET + visit_count)
time.sleep(0.5)
print(Fore.RED + "Created Date: " + Fore.RESET + created_date)
time.sleep(0.5)
print(Fore.RED + "Last Updated: " + Fore.RESET + updated_date)

print("")
print(Fore.GREEN + "===== CREATOR INFORMATION =====" + Fore.RESET)

json_file = requests.get(f'http://api.roblox.com/users/get-by-username?username={creator_name}')
json_data = json_file.json()
userid = json_data["Id"]

req = requests.get(f'https://www.roblox.com/users/{userid}/profile').content
soup = BeautifulSoup(req, 'html.parser')

soup2 = soup.find('div', {'class': 'hidden'})

followers = soup2.get('data-followerscount')
following = soup2.get('data-followingscount')
friends = soup2.get('data-friendscount')

# FINDING DATES

req = requests.get(f'https://www.roblox.com/users/{userid}/profile').content
soup = BeautifulSoup(req, 'lxml')
dates = soup.findAll('li', attrs={'class' : 'profile-stat'})

join_date_section = dates[0]
join_date = join_date_section.find('p', attrs={'class' : 'text-lead'}).text

total_visits = dates[1]
total_place_visits = total_visits.find('p', attrs={'class' : 'text-lead'}).text

print(Fore.RED + "Username: " + Fore.RESET + creator_name)
time.sleep(0.5)
print(Fore.RED + "Followers: " + Fore.RESET + followers)
time.sleep(0.5)
print(Fore.RED + "Friends: " + Fore.RESET + friends)
time.sleep(0.5)
print(Fore.RED + "Following: " + Fore.RESET + following)
time.sleep(0.5)
print(Fore.RED + "Join Date: " + Fore.RESET + join_date)
time.sleep(0.5)
print(Fore.RED + "Total Place Visits: " + Fore.RESET + total_place_visits)
?