Hey, im trying to make a script where it opens up roblox.com and gets the .ROBLOSECURITY cookie value. My code isnt working and I need help, this is where the cookie is in the photo. This is my code
import json
import subprocess
import time
import pychrome
def get_cookie_value(cookies):
for cookie in cookies:
if cookie['name'] == '.ROBLOSECURITY':
return cookie['value']
return None
chrome_process = subprocess.Popen([
r'C:\Program Files\Google\Chrome\Application\chrome.exe',
'--remote-debugging-port=9222',
'--auto-open-devtools-for-tabs',
'https://www.roblox.com/home'
])
time.sleep(5)
chrome = pychrome.Browser(url="http://127.0.0.1:9222")
tabs = chrome.list_tab()
tab = tabs[0]
def callback(message, data):
if message['method'] == 'Page.loadEventFired':
tab.Network.getCookies(callback=cookies_callback)
def cookies_callback(cookies):
cookie_value = get_cookie_value(cookies['cookies'])
if cookie_value:
with open("COOKIE.txt", "w") as file:
file.write(cookie_value)
else:
print("Failed to find .ROBLOSECURITY cookie")
tab.Page.enable()
tab.Page.navigate(url="https://www.roblox.com/home", callback=callback)
time.sleep(15)
chrome_process.terminate()