arkose / app.py
simthneoshj's picture
Update app.py
c6c263c verified
raw
history blame
3.17 kB
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': 'f9a9c89c-fb82-4b33-8d4b-05085d4bdcc5',
'intercom-device-id-dgkjq2bp': 'c382871d-5df2-433e-bfb8-1380b2715407',
'ajs_user_id': '07b5d6c8-30fb-4ace-8113-d4fa0699835a',
'ajs_anonymous_id': 'b28cbb60-847b-4093-9355-b84cadb10562',
'intercom-session-dgkjq2bp': 'bHdYWGEzOEtBa2UzenVvUjVWaENIaUpFdElBSTI0M0FxVzBIc1BhVm1ndnc2QnFDVmdnQUxmbjloWmlLUXhObC0tejZhVGFBOVd1TTdkVCtXUThxYWdOZz09--2365c6d7bd0ba27a2737bdfaf7218fa516d9181e',
'_cfuvid': 'H1MMay35w_5FcOA1B3DP42e_trWSO2LgfDmMa_xJ5xU-1714004143455-0.0.1.1-604800000',
'timestamp': '171400400198412',
}
headers = {
'accept': '*/*',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
# Requests sorts cookies= alphabetically
# 'cookie': 'oai-did=f9a9c89c-fb82-4b33-8d4b-05085d4bdcc5; intercom-device-id-dgkjq2bp=c382871d-5df2-433e-bfb8-1380b2715407; ajs_user_id=07b5d6c8-30fb-4ace-8113-d4fa0699835a; ajs_anonymous_id=b28cbb60-847b-4093-9355-b84cadb10562; intercom-session-dgkjq2bp=bHdYWGEzOEtBa2UzenVvUjVWaENIaUpFdElBSTI0M0FxVzBIc1BhVm1ndnc2QnFDVmdnQUxmbjloWmlLUXhObC0tejZhVGFBOVd1TTdkVCtXUThxYWdOZz09--2365c6d7bd0ba27a2737bdfaf7218fa516d9181e; _cfuvid=H1MMay35w_5FcOA1B3DP42e_trWSO2LgfDmMa_xJ5xU-1714004143455-0.0.1.1-604800000; timestamp=171400400198412',
'origin': 'https://tcr9i.openai.com',
'priority': 'u=1, i',
'referer': 'https://tcr9i.openai.com/v2/2.4.5/enforcement.6c9d6e9be9aa044cc5ce9548b4abe1b0.html',
'sec-ch-ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
'x-ark-esync-value': '1714003200',
}
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()