import streamlit as st import requests import json import time import random # 使用 st.cache 修饰器缓存函数结果,避免重复计算 @st.cache def get_random_data(): with open('data.txt', 'r') as file: lines = file.readlines() random_line = json.loads(random.choice(lines).strip()) return random_line # 创建 Streamlit 应用程序 def main(): st.title("Streamlit App") # 定义一个函数来获取 Arkose Token def get_arkose_token(): cookies = { 'oai-did': '46671c2e-bca8-42ef-bc50-48649770430f', 'ajs_user_id': '46671c2e-bca8-42ef-bc50-48649770430f', 'ajs_anonymous_id': '6ec1695c-4f61-4905-a85b-7310a24a4779', '_cfuvid': 'DVvOgDj0mo9_NrUPd._ocflCc67V7SGs2j5RU17RTKY-1713582204697-0.0.1.1-604800000', } headers = { 'authority': 'tcr9i.openai.com', 'accept': '*/*', 'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'origin': 'https://tcr9i.openai.com', 'referer': 'https://tcr9i.openai.com/v2/2.4.5/enforcement.6c9d6e9be9aa044cc5ce9548b4abe1b0.html', 'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120"', 'sec-ch-ua-mobile': '?1', 'sec-ch-ua-platform': '"Android"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36', 'x-ark-esync-value': '1713571200', } random_line = get_random_data() data = random_line['data'] response = requests.post('https://tcr9i.openai.com/fc/gt2/public_key/0A1D34FC-659D-4E23-B17B-694DCFCF6A6C', cookies=cookies, headers=headers, data=data).json() return response['token'] # 在 Streamlit 应用程序中添加 Arkose Token 的按钮 if st.button("Get Arkose Token"): token = get_arkose_token() st.write("Arkose Token:", token) # 运行 Streamlit 应用程序 if __name__ == "__main__": main()